Text Area
TextArea lets people type text that runs over several lines.
A TextArea lets people type text that runs over several lines, such as a description, a note or a message. For a single line, such as a name or an email address, use a TextField.
rows sets the starting height in lines, and the width comes from the container. People can drag the corner to make the box taller but not wider. To turn resizing off, set resize: "none" in style.
The visible box is a wrapper around a native textarea. className and style apply to the wrapper, ref points to the textarea, and every other prop, such as name, value or maxLength, goes to the textarea.
Put a TextArea in a Field with a FieldLabel so it has a name, and use a FieldError for the error message. aria-invalid shows the error colour. disabled stops typing and dims the text, while readOnly keeps the text selectable, removes the fill and still sends the value with the form. Set backdrop when the TextArea sits over an image or other content, and it uses the theme's glass material.
The focus ring appears whenever the cursor is inside the TextArea, however it got there, because typing is the only thing people do in it.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when the text area sits over other content, such as an image. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
size? | "1" | "2" | "3" | "4" | The size step of the text area, from 1 to 4. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
It also takes every prop of a <textarea>.
emphasisandtone— Every field in a form should look equally important, so a TextArea has no way to stand out from the fields around it.resize— A TextArea resizes vertically by default. To change that, setresizeinstyle, which applies to the visible box.cols— The container sets the width. A width counted in characters would change with every size and density.render— A TextArea renders two elements, and replacing either one would break the box or the text input inside it.