Textarea

Textarea is used to set a value that is multiple lines of text.

Page navigation navigation

React
readyNot reviewed for a11y
Rails
readyNot reviewed for a11y

React examples

Default

Resize behavior

Resizing guidelines

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.

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

This is a caption

With a validation message

Something went wrong

Props

Textarea

NameRequiredDescription
required
boolean
Indicates to the user and assistive technologies that the field value is required
cols
number
Specifies the visible width of a text area.
rows
number
Specifies the visible height of a text area.
block
boolean
Expands with width of the component to fill the parent elements
resize
'both' | 'horizontal' | 'vertical' | 'none'
Changes the resize behavior
contrast
boolean
Changes background color to a higher contrast color
validationStatus
'success' | 'error' | undefined
Style the textarea to match the current form validation status
ref
React.RefObject<HTMLTextAreaElement>
as
React.ElementType
sx
SystemStyleObject
className
string | undefined
The className to apply to the wrapper element