Textarea
Allows users to type multi-line text, comments, or long descriptions with support for auto-expanding height as they write.
2.1 KB
•Updated on August 21, 2026
Installation
Bash
pnpm dlx shadcn@latest add @spaceui/primitives-textareaUsage
Code
import { Textarea } from '@/components/ui/textarea'Code
<Textarea />Features
Sizes
Textarea controls in sm, default, and lg sizes.
Disabled
Textarea rendered in a disabled state via the disabled prop.
Read Only
Textarea configured in read-only mode via the readOnly prop.
Field Integration
Unlike Base UI's built-in form controls, Base UI does not provide a native Textarea primitive. This component wraps the native <textarea> element in Field.Control internally, so it integrates with Field out of the box — no need to wrap it in a FieldControl manually.
Code
<Field>
<FieldLabel>Bio</FieldLabel>
<Textarea placeholder="Tell us about yourself…" />
<FieldDescription>Write a short bio.</FieldDescription>
<FieldError>This field is required.</FieldError>
</Field>API Reference
Textarea
Styled native textarea element with custom size options.
| Prop | Type | Default | Description |
|---|---|---|---|
size | sm|default|lg|number | default | Controls the textarea padding. Number values are passed to the native rows attribute |
unstyled | boolean | false | When true, removes all default styling |
Examples
Textarea with label
Textarea in form
Textarea with label and required indicator
Textarea with optional label
Textarea with custom border and background
Textarea with characters remaining counter
Textarea field with required indicator
Shorter textarea with fixed height
Textarea with button aligned right
Textarea with button aligned left