Retrieve text input from a user.
The Input contain an additional Hooks, see subsection useInput for details.
Basic input field.
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.
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.
Update component in an uncontrolled way.
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 |
label | text label for input | string | - | - |
labelRight | text label at right for input | string | - | - |
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
}
}
Previous
Image
Next
Keyboard