---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Collapsible

One trigger that shows and hides the content right below it, such as more options, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Collapsible`.

## Try it

Fold and unfold it from its header (click, Enter or Space); switch the trigger’s look, open at first, the action beside it (it adds a note), disabled.

The notes are ours; nothing is pinned.

## When to use

- One trigger that shows and hides the content right below it, such as more options.
- Also called: disclosure or expander.

## When not to use

- For a stack of such sections use Accordion.

## 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 Collapsible 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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-collapsible.json --yes
```

```text
Add the Goop Collapsible to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import {
  Collapsible,
  CollapsibleAction,
  CollapsibleContent,
  CollapsibleHeader,
  CollapsibleTrigger,
} from '@/components/ui/goop/collapsible';

function ProjectSection() {
  return (
    <Collapsible defaultOpen>
      <CollapsibleHeader>
        <CollapsibleTrigger variant="item" mark={<span aria-hidden="true" className="size-3 rounded-sm bg-primary" />}>
          Field crews
        </CollapsibleTrigger>
        <CollapsibleAction icon="info" aria-label="Project details" />
      </CollapsibleHeader>
      <CollapsibleContent>
        <p className="ps-8 text-sm">Overview</p>
        <p className="ps-8 text-sm">Site visits</p>
      </CollapsibleContent>
    </Collapsible>
  );
}
```

- Fits: settings, flow: body.
- height, width, padding, gap, corner, background, text, motion: add no class for these.

## API reference

### Options

- `inset?: boolean = false` — The section sits in a padded container: its header's wash bleeds past the edge, its words and content on it.
- `open?: boolean`
- `defaultOpen?: boolean = false`
- `onOpenChange?: (open: boolean) => void`
- `disabled?: boolean`

- State: open (open / defaultOpen / onOpenChange); drawn by data-state=open

### Parts

- `CollapsibleHeader` — The row the trigger and its trailing control stand in
- `CollapsibleTrigger` — The header button that shows and hides the content; its children are the words before its chevron; variant: default (default), item; takes asChild; mark?: ReactNode — A leading glyph before the words: the caller's one element, in a 16 px box
- `CollapsibleAction` — A trailing glyph control in the header row, after the trigger and outside it; icon: IconName — The glyph's name in the theme's icon set (required); name the control with `aria-label`; also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; aria-label: string; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'
- `CollapsibleContent` — What the section shows while open; takes asChild

- Class recipes (cva): collapsibleTriggerVariants (CollapsibleTrigger)
- data-slot values (to select a part by): collapsible, collapsible-action, collapsible-content, collapsible-header, collapsible-icon, collapsible-indicator, collapsible-indicator-box, collapsible-inset, collapsible-label, collapsible-trigger

## Keyboard

- 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
- 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.

## Related

- [Accordion](/themes/meadow/components/accordion): Stacked sections that each open and close their own content.
- [Contents nav](/themes/meadow/components/contents-nav): A table of contents for a long reading page (an article, a guide, a help page), each link jumping to a section.
- [Navigation menu](/themes/meadow/components/navigation-menu): A site's header menu.
- [Steps](/themes/meadow/components/steps): A strip that shows which step of a flow the user is on, for display only.
