Preview
Design guidance
Use Textarea for instructions, feedback, and longer form answers. Use Composer for a chat message with attachments or sending controls. Give the field a visible label. Keep instructions and validation in Field or the application.
Four rows set the default initial and minimum height. Set rows for shorter or longer tasks. An explicit style.minHeight can override the minimum. The native corner grip resizes vertically. Its border mark doubles along both edges on hover and extends across the bottom during a drag; the right mark keeps its hover length. Motion follows the system’s reduced-motion preference. Set style={{ resize: "none" }} for a fixed field. The control fills its container; use the container width, native cols, or style to choose line length.
Installation
Install Field when using the labeled and validated examples below. Textarea itself remains a native control.
Basic usage
Structures
Textarea renders one native textarea. Use Field.Control render={<Textarea />} when the field needs Field registration and validation. Native attributes, events, and the ref reach that same element.
Examples
Outline
Use the default outline when the field needs a clear boundary.
Ghost
Blend editable text into the page without inner padding. The text aligns with its label. The surface and boundary stay transparent; hover and focus clarify only the text and placeholder.
Short feedback
Set rows={2} for a brief answer.
Long content
Set rows={8} for a research brief. The value stays caller-owned.
Fixed size
Use native style={{ resize: "none" }} when the surrounding layout must keep its height.
Invalid
Associate the field with a useful error message. required still uses native validation.
Read only
Keep a policy selectable and readable while preventing edits.
Disabled
Show an unavailable field with its current content.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "outline" | "ghost" | "outline" | Chooses the visible boundary. |
rows | number | 4 | Native initial row count and minimum height. Explicit rows override the default. |
cols | number | Native character width. The default CSS fills the container; set width:auto to use cols sizing. | |
style | React.CSSProperties | Native width, height, min/max height, and resize configuration. | |
value / defaultValue | string | Controlled value or initial uncontrolled content. | |
aria-invalid | boolean | "true" | "false" | Reports an invalid value; pair it with an associated message. | |
readOnly / disabled | boolean | false | Native editing and availability states. |
ref | React.Ref<HTMLTextAreaElement> | Points to the native textarea. |