npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-accordion.json --yesAccordion
ProStacked sections that each open and close their own content, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- AccordionItemOne section, holding one AccordionTrigger then one AccordionContent, named by its value
- AccordionTriggerThe button that opens and closes its section
- AccordionContentWhat an open section shows
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/goop/accordion';
function NoteSections() {
return (
<Accordion type="multiple" defaultValue={['visits']}>
<AccordionItem value="visits">
<AccordionTrigger>Visits</AccordionTrigger>
<AccordionContent>
<p className="text-sm">Survey, 4 March</p>
</AccordionContent>
</AccordionItem>
<AccordionItem value="permits">
<AccordionTrigger>Permits</AccordionTrigger>
<AccordionContent>
<p className="text-sm">Drainage permit due Friday</p>
</AccordionContent>
</AccordionItem>
</Accordion>
);
}Open a question with a click, Enter or Space; with one at a time a second closes the first and a second press closes it; turn on "Multiple" to keep them open together, "Long words" to see a header cut and a long answer. The questions and answers are our own sample words.
When to use
- Stacked sections that each open and close their own content.
- Also called: collapsible sections or disclosure.
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 Accordion on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-accordion.json --yesAdd the Goop Accordion to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/goop/accordion';
function NoteSections() {
return (
<Accordion type="multiple" defaultValue={['visits']}>
<AccordionItem value="visits">
<AccordionTrigger>Visits</AccordionTrigger>
<AccordionContent>
<p className="text-sm">Survey, 4 March</p>
</AccordionContent>
</AccordionItem>
<AccordionItem value="permits">
<AccordionTrigger>Permits</AccordionTrigger>
<AccordionContent>
<p className="text-sm">Drainage permit due Friday</p>
</AccordionContent>
</AccordionItem>
</Accordion>
);
}- height, width, padding, gap, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| type? | 'single' | 'multiple' | At most one section open at a time. Or: Each section opens and closes alone. |
| collapsible? | boolean = false | A press on the open section closes it, leaving none open. |
| value? | string | string[] | The open section's value ('' for none), held by the caller; with onValueChange. Or: The open sections' values, held by the caller; with onValueChange. |
| defaultValue? | string | string[] | The section open at first, when the accordion holds it. Or: The sections open at first, when the accordion holds them. |
| onValueChange? | ((value: string) => void) | ((value: string[]) => void) | Called with the open section's value, or the empty string when the open one is closed. Or: Called with the open sections' values. |
- State: value (value / defaultValue / onValueChange); drawn by data-state=open
| Part | What it is |
|---|---|
| AccordionItem | One section, holding one AccordionTrigger then one AccordionContent, named by its value; value: string — The section's name among its siblings: what value, defaultValue and onValueChange speak in; disabled?: boolean — The section cannot be opened or closed, and its trigger takes no focus |
| AccordionTrigger | The button that opens and closes its section; its children are the section's heading words; takes asChild |
| AccordionContent | What an open section shows |
- data-slot values (to select a part by): accordion, accordion-body, accordion-content, accordion-header, accordion-indicator, accordion-inner, accordion-item, accordion-label, accordion-trigger, accordion-viewport
Keyboard
| Key | What it does |
|---|---|
| Enter | Activate |
| Space | Activate |
Accessibility
- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- hover, focus-visible, focus-within: the browser's own (:hover, :focus-visible, :focus-within): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| expanded | the attribute data-state=open |
| open | the attribute data-state=open |
| disabled | the prop disabled |
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.