---
title: "Textarea"
description: "A field for text on many lines, such as a message. It grows with the text from 64px to 240px, then scrolls."
url: https://gelatinui.com/components/textarea
markdown_url: https://gelatinui.com/components/textarea.md
access: free
install: "npx shadcn@latest add @gelatin-ui/textarea"
registry_item: https://gelatinui.com/r/textarea.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Textarea

> A field for text on many lines, such as a message. It grows with the text from 64px to 240px, then scrolls.

Page: https://gelatinui.com/components/textarea

## When to use it

Best for: A multi-line text field that grows with its text and works inside a Field.

- Use it for text of more than one line, such as a comment or a note.
- Put it in a `Field` to add a label, help text, and validation.
- Use `InputGroupTextarea` when the box needs a toolbar or a header row.

## When not to use it

- For one line of text, use an [Input](https://gelatinui.com/components/input.md).
- For free text that turns into tags, use a [Tags Input](https://gelatinui.com/components/tags-input.md).

## Notes for agents

- `ref`, `id`, `name`, `disabled`, `value`, `defaultValue`, and `onValueChange` go to Base UI `Field.Control`, so a `Field` labels it.
- The box grows from 64px to 240px with `field-sizing: content`, then it scrolls.
- A browser with no `field-sizing` (Firefox) keeps a 64px box with a vertical handle.
- `size` sets only the padding (`sm`, `default`, `lg`). The height follows the text.

## Anatomy

```text
Textarea
```

## API reference

### Textarea

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `surface` | `"default" \| "group"` |  |  |
| `className` | `string` |  |  |
| `size` | `ControlSizeAtLeastSm` |  | The padding of the box: `sm`, `default`, or `lg` (the height follows the text). |

Also takes every prop of Base UI `Field.Control`: https://base-ui.com/react/components/field

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Textarea | `textarea` |  |  |  |

## Usage

Put it in a `Field`, so the label and the error link to it. The box grows with the text and then scrolls.

The sample also uses `field`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/textarea @gelatin-ui/field
```

```tsx title="support-message.tsx"
import { Field, FieldLabel } from "@/components/ui/field";
import { Textarea } from "@/components/ui/textarea";

export function SupportMessage() {
  return (
    <Field name="message">
      <FieldLabel>Message</FieldLabel>
      <Textarea placeholder="What do you need help with?" />
    </Field>
  );
}
```

## Compose

Build it with:

- [Form](https://gelatinui.com/components/form.md): Owns the submit and the errors.
- [Field](https://gelatinui.com/components/field.md): Names each control and shows its error text.
- [Input](https://gelatinui.com/components/input.md): Takes short text.
- [Stepper](https://gelatinui.com/components/stepper.md): Shows the steps of a long form.
- [Dialog](https://gelatinui.com/components/dialog.md): Holds a short form over the page.
- [Button](https://gelatinui.com/components/button.md): Submits or moves to the next step.
- [Alert](https://gelatinui.com/components/alert.md): Shows an error of the whole form.

Rules:

- Name every control (`label-every-control`): Give every field a visible `Label` (or a `Field`), and every icon button a `Tooltip` or an `aria-label`.
- Labels real apps use (`real-labels`): Write the button and menu labels that real apps use ("Create API key", "Invite members"), with no "…" at the end.
- No layout jump (`no-layout-jump`): When a state change adds, removes, or resizes content, reserve its space or animate its size, so nothing below it jumps.
- Touch targets (`touch-targets`): Give every control a hit area of at least 44 px on touch screens, even when it looks smaller.

Patterns: `gelatin://patterns/form-flow`

## Add it

```bash
npx shadcn@latest add @gelatin-ui/textarea
```

It adds 5 registry items: 2 files, 1177 lines, and the npm packages `@base-ui/react`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Input](https://gelatinui.com/components/input.md): Pick Input for one line of text, such as a name, an email address, or a URL.
- [Input Group](https://gelatinui.com/components/input-group.md)
- [Field](https://gelatinui.com/components/field.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves focus into or out of the field. |
| Enter | Adds a new line. |

## Accessibility

It is a Base UI `Field.Control`, a native `<textarea>`, so a `Field` labels it.

A read-only box has a muted fill. People can still select and copy the text.

A browser with no `field-sizing` keeps a 64px box with a vertical handle.
