Textarea
More than one line of text a person writes. The Input's look on a box that starts 64px tall and grows with what is typed.
<Textarea aria-label="System prompt" placeholder="You are a careful assistant." />Installation
import { Textarea } from "@catalog-developer/components/textarea";Usage
import { Field } from "@catalog-developer/components";
import { Textarea } from "@catalog-developer/components/textarea";<Field title="Description" optional>
<Textarea value={description} onChange={(event) => setDescription(event.target.value)} placeholder="What this agent is for." />
</Field>Where it is used
In the dashboard today it holds descriptions, notes, prompts, and pasted certificates and JSON. The dashboard's own components/ui/textarea.tsx renders it.
Two things are built on it. Text a managed run receives (a system prompt, a trigger's input) is the dashboard's RunTemplateTextarea: this Textarea under a layer that paints run variables as tokens. The rules assistant's composer is this Textarea with a send button beside it. Cedar rules are not a Textarea: they have their own editor.
Anatomy
- 1 — Box. The Input's fill, edge and 8px corner. The edge is a shadow, never a CSS border.
- 2 — Text. The value, or the placeholder in the muted color, 12px from the sides and 8px from the top and bottom.
- 3 — Resize handle. Only with
resizable. The browser's own.
| Starts at | Grows | Text | Corner | Side | Top and bottom |
|---|---|---|---|---|---|
| 64px (two lines) | With its text, no limit | 13px, 20px lines | 8px | 12px | 8px |
It grows with its text
Empty, it is 64px tall, which holds two lines. From the third line it grows a line at a time. It has no size prop: its text is 13px, the Input's at md. Type in the first one to see it.
<Textarea aria-label="System prompt" placeholder="You are a careful assistant." /><Textarea aria-label="System prompt" value={prompt} onChange={(event) => setPrompt(event.target.value)} />A height limit
A max-h-* class caps it. Past the cap it scrolls inside its box. A min-h-* class starts it taller, or shorter.
<Textarea className="max-h-32" aria-label="System prompt" value={prompt} onChange={(event) => setPrompt(event.target.value)} />Resizable
resizable shows the browser's handle at the bottom right. It resizes up and down only. Off by default.
<Textarea resizable aria-label="Certificate" placeholder="Paste the certificate here." />States
The Input's, on the same tokens: empty with a placeholder, filled, invalid (aria-invalid: a 1px red edge), read-only and disabled. Read-only and disabled share one muted fill; disabled also mutes the text and the edge. Focus adds a 3px band and a 1px line round the edge. Click or Tab into one to see it.
<Textarea aria-label="Empty" placeholder="Placeholder" /><Textarea aria-label="Filled" value={prompt} onChange={change} /><Textarea aria-label="Invalid" aria-invalid value={prompt} onChange={change} /><Textarea aria-label="Read-only" readOnly value={prompt} /><Textarea aria-label="Disabled" disabled value={prompt} />In a Field
The Textarea draws the box and nothing around it. Inside a Field, the Field's title names it, the description and the error are read with it, and an error marks it invalid. Beside its title (a horizontal Field) the title stays at the top of the row.
What the agent is told before every run.
<Field title="System prompt" description="What the agent is told before every run." error="Write at least one sentence."> <Textarea value={prompt} onChange={(event) => setPrompt(event.target.value)} /></Field>Beside an Input
The two share one fill, edge, corner, side padding and 13px text.
<Field title="Name"> <Input placeholder="billing-sync" /></Field><Field title="Description" optional> <Textarea placeholder="What this agent is for." /></Field>Keyboard and screen readers
Its name. A text area has no label of its own. Inside a Field the title names it. Outside one, a screen reader has only what you give it: an aria-label.
Keys. By default Enter adds a line and Tab leaves the box. A screen can change that: the rules assistant's composer sends on Enter.
Invalid, read-only, disabled. aria-invalid draws the red edge; a Field's error sets it and says why. A read-only text area stays in the tab order and can be selected and copied. A disabled one is skipped by Tab.
API Reference
Textarea
One prop of its own. Besides it, every prop of a <textarea> (value, onChange, placeholder, disabled, readOnly, maxLength, aria-invalid…).
| Prop | Type | Default | Description |
|---|---|---|---|
resizable | boolean | false | Shows the browser's resize handle at the bottom right, to drag the box taller or shorter. |
textRole | "body-2" | "body-1" | "body-2" | Its text's role: 13px, or 15px for a box that stands large on a page (the AI composer's compact size). |
className | string | — | Where a height limit goes (max-h-32), or another starting height (min-h-32). |
Rules
Decided
Shown on the agent's page.
Its title, help and error are the Field's
Decided with the form controls: no label is laid over a control by hand. A label over a control is the Field's title, and a press on it focuses the control.
One look with the Input
The Textarea takes the Input's fill, edge, focus band and invalid edge from the same tokens. It has no look of its own.
Open questions
Each of these is something another system advises or builds. None is decided for us.
When is it a Textarea, and when an Input?
OpenNot written down. Screens choose case by case.
Atlassian: for shorter text, use the text field.
How tall should it start?
Open64px. Screens change it with a min-h-* class today, taller for a prompt and shorter for the assistant's composer.
Polaris (its web components): the number of rows shown sets how much people expect to write.
Grow without limit, a fixed height, or a cap?
OpenIt grows with its text. No screen caps a Textarea with max-h-* today, and nothing says when to.
Atlassian's grows and shrinks with its content by default. Primer's is resized by hand in both directions by default, with growing as an option.
A placeholder?
OpenMany text areas show one. No rule says what it should hold.
They disagree. Atlassian: do not use placeholder text. Polaris (its web components): use it to show the format and tone.
A character count?
OpenNone. A limit is the native maxLength.
Atlassian has a counter with a minimum, a maximum or both, and calls it more accessible than the native limit. Primer has a character limit prop. Polaris (its web components) advises showing how many characters are left.
A monospace one?
OpenNo prop. Screens that want it pass a monospace text class today: the model form's JSON, the import card, the secret map.
Atlassian has a monospace prop on its text area.
Sizes?
OpenOne: 13px text, the Input's at md.
Atlassian has an isCompact prop. Primer, Polaris and shadcn show no size.
Buttons inside the box?
OpenNone. The assistant's composer and the run-template box put their buttons beside or under the Textarea.
shadcn's input group takes a text area with a bar above or below it, inside one box: a counter, a send button.
Other systems
Read for this page: shadcn's Textarea and Input Group pages; Atlassian's Text area (usage and code) and Form pages; GitHub Primer's Textarea page, its accessibility page and its props file in the primer/react repository; and Shopify Polaris's text area in its web components docs on shopify.dev (the React pages now redirect there). Base UI has no text area. States they share with ours are left out, and so is what the open questions above already cover.
| They expose | Ours | Why |
|---|---|---|
| Resizing sideways, or both ways (Primer, by default; Atlassian, as an option) | Ask | Not built: ours resizes up and down only. |
| A switch for growing with the text (Primer; Atlassian's resize modes) | Already there | Ours always grows. It cannot be turned off. |
| Rows, a minimum and a maximum height as props (Primer, Atlassian; rows in Polaris) | Ask | Not built. A min-h-* or max-h-* class does it today. |
| A success state (Primer) | Ask | Not built: ours has an invalid state only. |