npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-accordion.json --yesAccordion
ProStacked sections that each open and close their own content, for a FAQ or a long page of options, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- AccordionItemOne section
- AccordionTriggerThe button that opens and closes its section
- AccordionContentWhat an open section shows
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@/components/ui/goop/accordion';
<Accordion type="single" collapsible defaultValue="plan">
<AccordionItem value="plan">
<AccordionTrigger>Which plan am I on?</AccordionTrigger>
<AccordionContent>The free plan, until a second person joins the workspace.</AccordionContent>
</AccordionItem>
<AccordionItem value="export">
<AccordionTrigger>Can I take my notes with me?</AccordionTrigger>
<AccordionContent>Yes: every note exports as plain text from the settings.</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, for a FAQ or a long page of options.
- Also called: collapsible sections or disclosure.
When not to use
- For one section alone use Collapsible.
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>/trail-accordion.json --yesAdd the Goop Accordion to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@/components/ui/goop/accordion';
<Accordion type="single" collapsible defaultValue="plan">
<AccordionItem value="plan">
<AccordionTrigger>Which plan am I on?</AccordionTrigger>
<AccordionContent>The free plan, until a second person joins the workspace.</AccordionContent>
</AccordionItem>
<AccordionItem value="export">
<AccordionTrigger>Can I take my notes with me?</AccordionTrigger>
<AccordionContent>Yes: every note exports as plain text from the settings.</AccordionContent>
</AccordionItem>
</Accordion>- Fits: settings (its recipe).
- width, padding, border, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| type? | 'single' | 'multiple' = 'single' | 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. Or: The open sections' values, held by the caller. |
| 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 '' when it closes. Or: Called with the open sections' values, in the items' order. |
- State: value (value / defaultValue / onValueChange)
| Part | What it is |
|---|---|
| AccordionItem | One section; value: string — The section's name among its siblings, as value speaks it; disabled?: boolean = false — The section cannot be toggled; its trigger takes no focus |
| AccordionTrigger | The button that opens and closes its section; its children are the section's heading words; also takes asChild?: boolean |
| AccordionContent | What an open section shows |
- data-slot values (to select a part by): accordion, accordion-content, accordion-header, accordion-item
Keyboard
| Key | What it does |
|---|---|
| Tab | Move between the section headers |
| Enter | Open or close the focused section |
| Space | Open or close the focused section |
Accessibility
- The part itself answers the keys above.
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.