Capture multi-line text input from users. Ideal for comments, descriptions, and feedback.
import { Textarea } from '@fluxui-dev/react';<Textarea />
Display a hint inside the textarea to guide users on what to enter.
<Textarea label="Order notes" placeholder="No lettuce, tomato, or onion..."/>
Customize the height of the textarea by passing a rows prop.
<Textarea rows={2} label="Note" />
Using CSS's new field-sizing property, the textarea will automatically adjust its height to fit the content by passing in the rows="auto" prop.
<Textarea rows="auto" />
If you want to restrict the user from resizing the textarea, you can use the resize="none" prop.
<Textarea resize="vertical" /><Textarea resize="none" /><Textarea resize="horizontal" /><Textarea resize="both" />
|
Prop
|
Description
|
|---|---|
| placeholder |
Placeholder text displayed when the textarea is empty.
|
| label |
Label text displayed above the textarea. When provided, wraps the textarea in a Field component with an adjacent Field.Label component. See the field component.
|
| description |
Help text displayed above the textarea. When provided alongside label, appears between the label and textarea within the Field wrapper. See the field component.
|
| descriptionTrailing |
The description provided will be displayed below the textarea instead of above it.
|
| badge |
Badge text displayed at the end of the Field.Label component when the label prop is provided.
|
| error |
Error message displayed below the textarea that marks it invalid, defaulting to the validation error for its name.
|
| value |
Controlled value of the textarea, paired with onValueChange.
|
| defaultValue |
Initial value of the textarea when uncontrolled.
|
| onValueChange |
Callback fired with the new string value when the value changes, while onChange remains available for the raw event.
|
| rows |
Number of visible text lines. Use "auto" for automatic height adjustment. Default: 4.
|
| resize |
Control how the textarea can be resized. Options: vertical (default), horizontal, both, none.
|
| disabled |
Prevents user interaction with the textarea.
|
| invalid |
If true, applies error styling to the textarea.
|
| className |
CSS classes applied directly to the textarea element rather than the wrapping field, even when label is set.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-textarea |
Applied to the textarea element for styling and identification.
|