import { Textarea } from "@/components/ui/textarea"
export default function TextareaDemo() {
return <Textarea placeholder="Type your message here." />
}Installation
npx logic2b@latest add textareaWorking with an AI assistant? Copy this prompt into Claude Code, Cursor or Copilot — it carries the install steps, a no-CLI fallback and a verification checklist.
Add the "textarea" item from the logic2b ui registry (https://ui.logic2b.com) to this project. Follow every step and verify at the end. ## Steps 1. If the project has no `components.json` yet, set up logic2b ui first: ```bash npx logic2b@latest init ``` 2. Install the item (the CLI resolves registry dependencies automatically): ```bash npx logic2b@latest add textarea ``` 3. Install any npm dependencies the command prints. ## If the CLI is not available Do it manually from the registry payload: 1. Fetch https://ui.logic2b.com/r/textarea.json. 2. Write every entry in `files[]` to its mapped project path (see below). 3. Repeat (recursively) for each name in `registryDependencies`. 4. Install every package listed in `dependencies` across those payloads. ## Registry reference - Index of every item: https://ui.logic2b.com/r/index.json - Item payload (full source): https://ui.logic2b.com/r/<name>.json - Usage examples per item: https://ui.logic2b.com/r/demos/index.json → https://ui.logic2b.com/r/demos/<demo>.json - Docs index for agents: https://ui.logic2b.com/llms.txt (full docs: https://ui.logic2b.com/llms-full.txt) - Every docs page is Markdown when you append `.md` to its URL. Registry file paths map to project paths like this: - `ui/*` → `@/components/ui/*` - `blocks/<name>/*` → `@/components/*` - `charts/*` → `@/components/charts/*` - `hooks/*` → `@/hooks/*` - `lib/utils.ts` → `@/lib/utils.ts` - `theme.css` → next to the project's Tailwind entry stylesheet ## Conventions (do not break these) - Tailwind CSS v4 (CSS-first config; no tailwind.config.js needed) and React 19. - All colors go through semantic tokens (`bg-primary`, `text-muted-foreground`, `border-border`, …). Never hardcode hex/oklch values in components. - Dark mode is class-based: toggle `.dark` on `<html>`. - Icons come from lucide-react. ## Verify before finishing 1. The dev server starts and the app renders without console errors. 2. TypeScript compiles (`tsc --noEmit` or the framework's check). 3. Components use the theme: a `<Button>` shows the primary token color, and toggling `.dark` on `<html>` switches the palette.
Copy into ui/textarea.tsx:
import * as React from "react"
import { cn } from "@/lib/utils"
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
return (
<textarea
data-slot="textarea"
className={cn(
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className
)}
{...props}
/>
)
}
export { Textarea }Usage
import { Textarea } from "@/components/ui/textarea"
<Textarea placeholder="Type your message here." />
API
Textarea renders a native <textarea> and forwards every prop it accepts. It
auto-sizes to its content (field-sizing-content) and styles aria-invalid for
validation states.
| Prop | Type | Default |
|---|---|---|
placeholder |
string |
— |
value / defaultValue |
string |
— |
disabled |
boolean |
false |
rows |
number |
— |
className |
string |
— |
...props |
React.ComponentProps<"textarea"> |
— |
Examples
With label
Your message will be copied to the support team.
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
export default function TextareaLabelDemo() {
return (
<div className="grid w-[360px] gap-2">
<Label htmlFor="message">Your message</Label>
<Textarea id="message" placeholder="Type your message here." />
<p className="text-muted-foreground text-sm">
Your message will be copied to the support team.
</p>
</div>
)
}Disabled
import { Textarea } from "@/components/ui/textarea"
export default function TextareaDisabledDemo() {
return (
<Textarea
disabled
placeholder="Type your message here."
className="w-[360px]"
/>
)
}With a button
import { Button } from "@/components/ui/button"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
export default function TextareaFormDemo() {
return (
<form
className="grid w-[360px] gap-3"
onSubmit={(event) => event.preventDefault()}
>
<Label htmlFor="feedback">Feedback</Label>
<Textarea id="feedback" placeholder="Tell us what you think..." />
<Button type="submit" className="justify-self-start">
Send feedback
</Button>
</form>
)
}