Input
freeInput provides consistent text entry for forms, search, and editable notes.
Installation
Add this component with the NateUI CLI.
Examples
Basic
Size
Disabled
Affix
Password Visibility
Textarea
Invalid
Controlled
Current value: northwind-sales
API
Input renders either a native input, a textarea, or an affixed input wrapped by InputWrapper.
Input
Input accepts the props below plus native input and textarea props, except the native size and prefix attributes.
| Prop | Description | Type | Default |
|---|---|---|---|
className | Class names applied to the input root, or to InputWrapper when prefix or suffix is present. | string | - |
defaultValue | Initial value for uncontrolled usage. | string | number | readonly string[] | - |
disabled | Prevents editing and applies disabled control styling. | boolean | - |
invalid | Applies invalid styling; also inherits invalid state from Form.Field. | boolean | - |
onChange | Called when the input value changes. | InputChangeHandler | - |
placeholder | Placeholder text rendered by the native input or textarea. | string | - |
prefix | Content rendered before the editable value inside an affixed input. | InputAffix | - |
readOnly | Prevents editing while keeping the field focusable. | boolean | - |
ref | Ref forwarded to the rendered input or textarea element. | InputRef | - |
rows | Number of visible text rows when textArea is true. | number | - |
size | Control size. | ControlSize | 'md' |
suffix | Content rendered after the editable value inside an affixed input. | InputAffix | - |
textArea | Renders a textarea instead of an input. | boolean | false |
type | Native input type when textArea is false. | HTMLInputTypeAttribute | 'text' |
value | Controlled value. undefined and null are normalized to an empty string. | string | number | readonly string[] | - |
...nativeInputProps | Native props for the rendered input or textarea, except size and prefix. | NativeInputProps | - |
InputWrapper
InputWrapper is the affix container used by Input when prefix or suffix is provided.
| Prop | Description | Type | Default |
|---|---|---|---|
children | Editable control rendered between the affix slots. | ReactNode | - |
className | Class names applied to the wrapper root. | string | - |
disabled | Applies disabled wrapper and affix styling. | boolean | - |
invalid | Applies invalid wrapper and affix styling; also inherits invalid state from Form.Field. | boolean | - |
prefix | Content rendered before children. | ReactNode | - |
readOnly | Removes focus ring styling when the wrapped control is read-only. | boolean | - |
ref | Ref forwarded to the wrapper span. | Ref<HTMLSpanElement> | - |
size | Control size. | ControlSize | 'md' |
suffix | Content rendered after children. | ReactNode | - |
...nativeSpanProps | Native props applied to the wrapper span, except prefix. | NativeInputWrapperProps | - |