Capítulo 25 de 108
Displays a form textarea, or a component styled to look like one, for multi-line text input.
disabled: standard HTML prop to disable the textarea; pair with data-disabled on the wrapping Field to style the disabled state.aria-invalid: marks the textarea as invalid for accessibility; pair with data-invalid on Field to style the invalid state.Field / FieldLabel / FieldDescription: composable wrapper components (from @/components/ui/field) used to attach a label and description to a plain Textarea.Textarea itself, pass dir={dir} through from a translation/direction context; see the RTL configuration guide.import { Textarea } from "@/components/ui/textarea"
export function TextareaDemo() {
return <Textarea placeholder="Type your message here." />
}
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Textarea } from "@/components/ui/textarea"
export function TextareaField() {
return (
<Field>
<FieldLabel htmlFor="textarea-message">Message</FieldLabel>
<FieldDescription>Enter your message below.</FieldDescription>
<Textarea id="textarea-message" placeholder="Type your message here." />
</Field>
)
}
Field.<div className="grid w-full gap-2">
<Textarea placeholder="Type your message here." />
<Button>Send message</Button>
</div>
Button para formulário de envio rápido.Textarea: o padrão da lib é colocar data-disabled/data-invalid no Field pai, não em classes condicionais na própria textarea.Textarea sozinho é só o input; para forms completos sempre envolver com Field/FieldLabel/FieldDescription.aria-invalid (a11y) + data-invalid no Field (estilo), não por uma prop error custom.dir manualmente, não é automático.@/components/ui/field): wrapper padrão para label/descrição/estado em qualquer input, incluindo Textarea, Checkbox, Select etc.