Components
Textarea
a multi-line text input with validation styling
Loading...
Installation
pnpm dlx shadcn@latest add https://prototyper-ui.com/r/textarea.jsonnpx shadcn@latest add https://prototyper-ui.com/r/textarea.jsonyarn dlx shadcn@latest add https://prototyper-ui.com/r/textarea.jsonbunx --bun shadcn@latest add https://prototyper-ui.com/r/textarea.jsonThis will add the following files to your project:
components/ui/textarea.tsx
Usage
import { Textarea } from "@/components/ui/textarea"<Textarea placeholder="Type your message here." />Styling
Data Slots
Use data-slot attributes to target the textarea in CSS:
| Slot name | Element |
|---|---|
textarea | The <textarea> root |
Customization Examples
/* Make all textareas taller */
[data-slot="textarea"] {
@apply min-h-32 text-lg;
}{/* Override styles via className */}
<Textarea className="rounded-xl px-5" placeholder="Custom textarea" />API Reference
Textarea
A styled multi-line text input.
Prop
Type
All native textarea props are forwarded via ...props.
Accessibility
Keyboard Interactions
| Key | Action |
|---|---|
Tab | Moves focus into or out of the textarea |
ARIA Attributes
- Renders as a native
<textarea>element. aria-invalidstyling is applied when the textarea has validation errors.- Pair with a
<label>oraria-labelto ensure the textarea is accessible to screen readers.
Stream UI
This component is available in @prototyperai/stream-ui.
Catalog Definition
import { z } from "zod"
import { defineComponent } from "@prototyperai/stream-ui/catalog"
export default defineComponent({
description: "A multi-line text area for longer form input",
props: z.object({
label: z.string().optional().describe("Label displayed above the textarea"),
placeholder: z.string().optional().describe("Placeholder text"),
value: z.string().optional().describe("Controlled textarea value"),
rows: z.number().optional().describe("Number of visible text rows"),
disabled: z.boolean().optional().describe("Whether the textarea is disabled"),
}),
events: ["change", "blur", "focus"],
example: { label: "Message", placeholder: "Type your message...", rows: 3 },
})Example Spec
{
"root": "messageArea",
"elements": {
"messageArea": {
"type": "Textarea",
"props": {
"label": "Message",
"placeholder": "Type your message...",
"rows": 3
},
"$bindState": { "path": "/message", "event": "change" }
}
}
}Learn more in the Stream UI documentation.