Retrieve multi-line user input.
Basic usage.
Specify width manually.
Disable interactive textarea.
Differentiate states by color.
Capture changes in textarea.
useInput
Use hooks
to capture changes.
Update component in an uncontrolled way.
Textarea.Props
[alias: Input.Textarea
]Attribute | Description | Type | Accepted values | Default |
---|---|---|---|---|
value | textarea value | string | - | - |
initialValue | textarea value | string | - | - |
placeholder | placeholder | string | - | - |
status | current status | NormalTypes | 'default', 'secondary', 'success', 'warning', 'error' | default |
readOnly | native attr | boolean | - | false |
disabled | disable input | boolean | - | false |
width | set width string | string | - | initial |
minHeight | set min-height string | string | - | - |
onChange | change event | (e: React.ChangeEvent) => void | - | - |
... | native props | TextareaHTMLAttributes | 'form', 'id', 'className', ... | - |
useInput
type useInput = (
initialValue: string,
) => {
state: string
setState: Dispatch<SetStateAction<string>>
currentRef: MutableRefObject<string>
reset: () => void
bindings: {
value: string
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void
}
}