components / form
Textarea
Long text field that grows with its content, no JavaScript.
451 B gzip client componentbase ui · field
the field grows on its own as you type.
textarea-default.tsx
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";
import { Textarea } from "@/components/ui/textarea";
export default function TextareaDefault() {
return (
<Field className="w-full max-w-sm">
<FieldLabel>message</FieldLabel>
<Textarea placeholder="tell us what you need…" />
<FieldDescription>the field grows on its own as you type.</FieldDescription>
</Field>
);
}Installation
$ npx shadcn@latest add https://cd-ui.vercel.app/r/textarea.jsonfirst time? set up components.json and the theme first: see installation.
Usage
import { Textarea } from "@/components/ui/textarea"
<Textarea placeholder="message" />API
Textarea
Base UI · Field.Control<textarea> that grows with its content via field-sizing: content (no JS). Integrates with Field.
| prop | type | default |
|---|---|---|
...propsEverything from the native | ComponentProps<"textarea"> | - |
classNameExtra classes, merged with | string | - |