formsinput
Input
Text input component with icon slots, loading state, and form field integration.
Import#
Slot Structure#
Text input shell with optional leading and trailing icon slots.
Examples#
Variants#
Visual style variants.
Sizes#
From xs to xl.
With Icons#
Leading and trailing icon slots.
States#
Loading, disabled, and type.
API Reference#
Attributes#
Slot
root0 attributesInput wrapper that positions icons, loading state, and the native input.
No attribute metadata for this slot.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| autocomplete | JSX.InputHTMLAttributes<HTMLInputElement>["autocomplete"] | undefined | off | The autocomplete attribute for the input. |
| autofocus | boolean | undefined | false | Whether the input should automatically receive focus on mount. |
| autofocusDelay | number | undefined | 0 | The delay in milliseconds before automatically focusing the input. |
| children | JSX.Element | — | Additional content to render inside the input container. |
| class | ClassValue | — | Class applied to the component root or trigger element. |
| classes | InputT.Classes | undefined | — | — |
| defaultValue | InputT.Value | — | The default value of the input (uncontrolled). |
| disabled | boolean | undefined | false | Whether the input is disabled. |
| id | string | undefined | — | The ID of the input element. |
| leading | IconT.Name | — | Leading icon name. |
| loading | boolean | undefined | false | Whether the input is in a loading state. |
| loadingIcon | IconT.Name | icon-loading | The icon to show when the input is in a loading state. |
| maxLength | string | number | undefined | — | The maximum number of characters allowed in the input. |
| modelModifiers | M | undefined | — | Modifiers for the input value (e.g., trim, lazy, number). |
| name | string | undefined | — | The name of the input element, used for form submission. |
| onBlur | JSX.FocusEventHandlerUnion<HTMLInputElement, FocusEvent> | undefined | — | Event handler for the blur event. |
| onChange | ((value: ModifierValue<M>) => void) | undefined | — | Callback when the input value change is committed. |
| onFocus | JSX.FocusEventHandlerUnion<HTMLInputElement, FocusEvent> | undefined | — | Event handler for the focus event. |
| onInput | JSX.InputEventHandlerUnion<HTMLInputElement, InputEvent> | undefined | — | Event handler for the input event. |
| onValueChange | ((value: ModifierValue<M>) => void) | undefined | — | Callback when the input value changes during input. |
| placeholder | string | undefined | — | The placeholder text for the input. |
| readOnly | boolean | undefined | false | Whether the input is read-only. |
| ref | JSX.HTMLElementTags["div"] extends { ref?: infer Ref; } ? Ref : never | undefined | — | — |
| required | boolean | undefined | false | Whether the input is required. |
| size | "xs" | "sm" | "md" | "lg" | "xl" | undefined | — | — |
| style | JSX.CSSProperties | undefined | — | — |
| styles | InputT.Styles | undefined | — | — |
| trailing | IconT.Name | — | Trailing icon name. |
| type | JSX.InputHTMLAttributes<HTMLInputElement>["type"] | undefined | text | The type of the input element. |
| value | InputT.Value | — | The current value of the input (controlled). |
| variant | "none" | "outline" | "ghost" | "subtle" | undefined | — | — |