Textarea
The multi-line sibling of Input, with the same styles and floating label. It grows as you type, so short notes stay small and long ones get room.
Install
Installs Field, the shell it shares with Input.
npx shadcn@latest add @nelumbo/textareaVariants
The label rests on the first line and rises on focus. Type a few lines: the box grows up to maxRows, then scrolls.
filled
Visible to everyone on the project.
48 / 160
outlined
Visible to everyone on the project.
48 / 160
Sizes
sm tightens the padding, for comments and dense panels.
Without a label
The placeholder stays visible. Give the field an aria-label.
Usage
import { Textarea } from "@/components/ui/textarea"<Textarea label="Message" maxLength={280} description="Visible to the whole team." /><Textarea variant="outlined" size="sm" label="Comment" rows={2} maxRows={6} />Props
className goes to the wrapper; all other props and the ref go to the <textarea>.
| Prop | Type | Default | Notes |
|---|---|---|---|
label | string | Floating label. Leave out and set aria-label instead | |
variant | "filled" | "outlined" | "filled" | |
size | "default" | "sm" | "default" | |
rows | number | 3 | Starting height in lines |
maxRows | number | 8 | Grows to this many lines, then scrolls |
maxLength | number | Also shows a character count | |
description | ReactNode | Help text, linked with aria-describedby | |
error | ReactNode | boolean | Marks the field invalid; a message replaces the description |