Text Area
Allows users to enter and edit long form information.
<TextArea aria-label="description" placeholder="Enter description..." />
Usage
Label
Attach a label to the select using the label
prop.
<TextArea label="Description" />
HelperText
Add additional context as well as display error messages with the helperText
prop.
<TextArea label="Description" helperText="Please enter a description" />
Controlled
A text area's state can be controlled by a parent React component by setting the value
prop and
passing a handler to the onChange
prop.
function ControlledExample() { const [value, setValue] = React.useState( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', ); return <TextArea aria-label="description" onChange={setValue} value={value} />; }
Disabled State
Set the isDisabled
prop to prevent a user from inputting text.
<TextArea aria-label="description" isDisabled />
Props
as?The root element to be rendered