Components

Input

A React input with a Liquid Glass field and icon slots.

Input renders a glass control around a native <input>, with optional leading and trailing icons. The input owns its glass surface and native form behavior; wrap it in Field to provide a visible label, description, and validation message.

Basic example

Use value with onValueChange for a controlled field, or defaultValue for an uncontrolled one. Native input attributes such as type, name, placeholder, required, and readOnly are forwarded. size is reserved for the component's visual scale, and style merges into the outer root alongside className.

We only use this address for account notices.

Enter an email address.

Sizes

Five sizes are available: xs, sm, md, lg, and xl. Height, padding, radius, text, and icon sizes scale together. Pass the same size to Field when the label and message should match.

Icons

leadingIcon renders before the input and trailingIcon after it. Both slots are decorative and receive aria-hidden="true"; use the visible label from Field, or aria-label when there is no visible label.

States

disabled is forwarded to the native input and fades the control. Set disabled on Field when the input is wrapped so the label and message fade with it. readOnly keeps the value focusable and selectable while preventing edits.

The value cannot be changed.

The value can be selected and copied.

Accessibility

Input renders a native <input>. Wrap it in Field to give it a visible label, description, and validation message; Field wires aria-describedby and aria-invalid for you. Use aria-label or aria-labelledby only when no visible label is rendered; placeholder text is not a label. Icon slots are decorative. Native attributes such as required, name, and type keep native form behavior. See the accessibility guide for labeling patterns.

API reference

PropTypeDefaultDescription
leadingIconReactNode—Decorative icon before the input.
trailingIconReactNode—Decorative icon after the input.
size"xs" | "sm" | "md" | "lg" | "xl""md"Controls height, padding, radius, text, and icon size.
valuestring | number | readonly string[]—Controlled value.
defaultValuestring | number | readonly string[]—Initial value when uncontrolled.
onValueChange(value: string, details) => void—Called when the value changes.
typeHTMLInputTypeAttribute"text"Native input type.
placeholderstring—Placeholder text.
namestring—Form field name.
idstringgeneratedID of the input. A generated ID is used when omitted.
disabledbooleanfalseDisables the input and fades the whole control.
readOnlybooleanfalsePrevents edits while keeping the value focusable and selectable.
requiredbooleanfalseRequires a value for form submission.
aria-labelstring—Accessible name when no visible label is rendered.
aria-labelledbystring—ID reference for an external accessible name.
aria-describedbystring—ID reference for extra supporting text. Field descriptions and errors are merged with this value.
renderReactElement | ((props, state) => ReactElement)—Replaces the input element.
refRef<HTMLElement>—Ref forwarded to the input element.
classNamestring—Tailwind classes merged into the outer root.
styleCSSProperties—Inline styles merged into the same element as className.
ui{ root?: ClassValue; control?: ClassValue; glass?: ClassValue; overlay?: ClassValue; leadingIcon?: ClassValue; input?: ClassValue; trailingIcon?: ClassValue }—Tailwind classes for internal slots, keyed by data-slot.
AttributeDescription
data-disabledPresent when the input is disabled.
data-validPresent when the input is valid and wrapped in Field.
data-invalidPresent when the input is invalid and wrapped in Field.
data-touchedPresent after the input is touched while wrapped in Field.
data-dirtyPresent after the input value changes while wrapped in Field.
data-filledPresent when the input has a value while wrapped in Field.
data-focusedPresent when the input is focused while wrapped in Field.
data-slotMarks internal parts (root, control, glass, overlay, leading-icon, input, trailing-icon) for styling.

Theming

The component uses the shared glass material. Tune shared --ui-glass-* tokens on a parent, use className and style for layout, and use ui for internal slots keyed by data-slot. style applies to the outer root; use ui.input for the native input. Component-specific values live in src/theme/input.ts. See the theming guide for token layers and presets.

  • Field — Adds a label, description, and validation message around the input.
  • Select — For choosing from a fixed set of values.
  • Checkbox — For boolean fields.
  • Slider — For numeric ranges.