npx shadcn@4.23.1 add @goop/meadow-textareaTextarea
FreeA multi-line field for free words, such as a task's notes, a description, a comment or a message, that grows by rows as a person types, for React and Tailwind CSS. Free, MIT.
What an agent sees
import { useState } from 'react';
import { Textarea } from '@/components/ui/goop/textarea';
function TaskNotes({ onSave }: { onSave: (notes: string) => void }) {
const [notes, setNotes] = useState('');
return (
<div className="flex flex-col gap-2 w-80">
<label htmlFor="task-notes" className="text-sm font-medium">
Notes
</label>
<Textarea
id="task-notes"
placeholder="Add a note for the crew"
rows={3}
value={notes}
onChange={(event) => setNotes(event.target.value)}
onBlur={() => onSave(notes)}
/>
</div>
);
}
function VisitReport({ report, error }: { report: string; error?: string }) {
return <Textarea aria-label="Visit report" defaultValue={report} aria-invalid={error ? true : undefined} />;
}
function CrewInstructions() {
return <Textarea aria-label="Instructions for the crew" counter maxLength={2000} rows={5} />;
}
function DraftMessage() {
return <Textarea variant="bare" aria-label="Message" defaultValue="Bring gloves on Saturday." />;
}
function TodoCardNotes() {
return <Textarea variant="dialog" aria-label="Notes" placeholder="Add a note" className="-mx-1" />;
}Type several lines and watch it grow; switch every look, long words, disabled and invalid. Nothing is sent.
When to use
- A multi-line field for free words, such as a task's notes, a description, a comment or a message, that grows by rows as a person types.
- Also called: multiline text input.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Textarea on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.
npx shadcn@4.23.1 add @goop/meadow-textareaAdd the Goop Textarea to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { useState } from 'react';
import { Textarea } from '@/components/ui/goop/textarea';
function TaskNotes({ onSave }: { onSave: (notes: string) => void }) {
const [notes, setNotes] = useState('');
return (
<div className="flex flex-col gap-2 w-80">
<label htmlFor="task-notes" className="text-sm font-medium">
Notes
</label>
<Textarea
id="task-notes"
placeholder="Add a note for the crew"
rows={3}
value={notes}
onChange={(event) => setNotes(event.target.value)}
onBlur={() => onSave(notes)}
/>
</div>
);
}
function VisitReport({ report, error }: { report: string; error?: string }) {
return <Textarea aria-label="Visit report" defaultValue={report} aria-invalid={error ? true : undefined} />;
}
function CrewInstructions() {
return <Textarea aria-label="Instructions for the crew" counter maxLength={2000} rows={5} />;
}
function DraftMessage() {
return <Textarea variant="bare" aria-label="Message" defaultValue="Bring gloves on Saturday." />;
}
function TodoCardNotes() {
return <Textarea variant="dialog" aria-label="Notes" placeholder="Add a note" className="-mx-1" />;
}- Fits: flow (its recipe).
- Its look is its own: a
classNameplaces it (width, margin, flex or grid place), never restyles it; withcounterit places the field and its count together. An action beside the field is the caller's, in a wrapper element round it. - width, padding, corner, background, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| variant | default | bare | unstyled | dialog = default | |
| counter? | boolean = false | Shows the count of characters written against maxLength in the field's foot corner; false by default. |
| value? | string | |
| defaultValue? | string | |
| onChange? | (event: ChangeEvent<HTMLTextAreaElement>) => void | |
| name? | string | |
| required? | boolean | |
| disabled? | boolean | |
| form? | string | |
| Defaults | rows = 1 |
- Class recipes (cva): textareaVariants (Textarea)
- data-slot values (to select a part by): textarea, textarea-counter, textarea-frame
Accessibility
- The native element answers the keyboard.
- hover, focus: the browser's own (:hover, :focus): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| focus-visible | the attribute data-focus-visible |
| disabled | the prop disabled |
| invalid | the attribute aria-invalid |
| placeholder-shown | the prop placeholder |
Motion
- The part sets its own motion: add no transition or animation of your own.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.