Retrieve text input from a user.
The Input contain an additional Hooks, see subsection useInput for details.
Basic input field.
With floating the label sits inside the field and moves up when you type or focus. It replaces the placeholder.
Inputs of different sizes.
Specify width or other styles.
Disable interactive inputs.
Show a short label in the line.
Labels for custom styles.
Differentiate states by color.
You can completely round the corners of any type of Input with the rounded property.
Use filled, light, ghost or subtle to change the surface of any colored Input.
Specify an icon component.
Add a clear button in the input box.
Input component with a show/hide password functionality, Important: You have to use the Input.Password component.
Capture changes in input.
htmlType takes the native types, like date, time and datetime-local. The browser draws the picker, in the language and with the keyboard of the user, and it follows the theme.
Update component in an uncontrolled way.
Validate on submit and say what to fix, under the field. The error type turns the field red.
| Attribute | Description | Type | Accepted values | Default |
|---|---|---|---|---|
| value | input value | string | - | - |
| initialValue | initial value | string | - | - |
| placeholder | placeholder | string | - | - |
| type | current type | InputTypes | InputTypes | default |
| htmlType | native type attr | string | - | text |
| readOnly | native attr | boolean | - | false |
| disabled | disable input | boolean | - | false |
| clearable | show clear icon | boolean | - | false |
| filled | filled variant | boolean | - | false |
| light | light variant | boolean | - | false |
| ghost | outline variant | boolean | - | false |
| subtle | subtle variant | boolean | - | false |
| label | text label for input | string | - | - |
| labelRight | text label at right for input | string | - | - |
| floating | label inside the field that moves up on focus | boolean | - | false |
| icon | icon for input | React.ReactNode | - | - |
| iconRight | icon at right for input | React.ReactNode | - | - |
| iconClickable | icons are clickable | boolean | - | false |
| onIconClick | click icon event | (e: React.ChangeEvent) => void | - | - |
| onChange | change event | (e: React.ChangeEvent) => void | - | - |
| onClearClick | clear icon event | (e: React.MouseEvent) => void | - | - |
| ref | forwardRef | Ref<HTMLInputElement | null> | - | - |
| ... | native props | InputHTMLAttributes | 'alt', 'type', 'className', ... | - |
| Attribute | Description | Type | Accepted values | Default |
|---|---|---|---|---|
| hideToggle | hide toggle icon | boolean | - | false |
| ... | input props | Input.Props | Input.Props | - |
type InputTypes =
'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'
type useInput = (initialValue: string) => {
state: string
setState: Dispatch<SetStateAction<string>>
currentRef: MutableRefObject<string>
reset: () => void
bindings: {
value: string
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void
}
}