Textarea
Textarea is used to set a value that is multiple lines of text.
Page navigation navigation
React examples
Default
Resize behavior
This example prevents the Textarea from being resized in any direction, but you can also limit resizing to horizontal or vertical.
Customized width
Defaults to 30-character width; can be set to be any number of characters or fill the parent width. For 100% width, use the block prop instead.
Customized height
Defaults to 7 lines; can be adjusted to any number of lines based on expected content length. Users can scroll if content exceeds the set height.
Required
With a caption
With a validation message
Props
Textarea
| Name | Default | Description |
|---|---|---|
required | booleanIndicates to the user and assistive technologies that the field value is required | |
cols | numberSpecifies the visible width of a text area. | |
rows | numberSpecifies the visible height of a text area. | |
block | false | booleanExpands with width of the component to fill the parent elements |
resize | 'both' | 'both' | 'horizontal' | 'vertical' | 'none'Changes the resize behavior |
contrast | false | booleanChanges background color to a higher contrast color |
validationStatus | 'success' | 'error' | undefinedStyle the textarea to match the current form validation status | |
ref | React.RefObject<HTMLTextAreaElement> | |
as | "input" | React.ElementType |
sx Deprecated | SystemStyleObject | |
className | string | undefinedThe className to apply to the wrapper element | |
minHeight | numberThe minimum height of the textarea | |
maxHeight | numberThe maximum height of the textarea |