Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-collapsible.json --yes

Collapsible

Pro

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

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

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.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-collapsible.json --yes
PROMPT
Add the Goop Collapsible to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { Collapsible, CollapsibleHeader, CollapsibleTrigger, CollapsibleAction, CollapsibleContent } from '@/components/ui/goop/collapsible';
import { Card, CardContent } from '@/components/ui/goop/card';
import { Checkbox } from '@/components/ui/goop/checkbox';
import { Button } from '@/components/ui/goop/button';

<>
  <Collapsible defaultOpen>
    <CollapsibleHeader>
      <CollapsibleTrigger>Details</CollapsibleTrigger>
    </CollapsibleHeader>
    <CollapsibleContent>…</CollapsibleContent>
  </Collapsible>
  <Card variant="outline">
    <CardContent>
      <Collapsible inset defaultOpen>
        <CollapsibleHeader>
          <Checkbox aria-label="Invite a teammate: done" />
          <CollapsibleTrigger variant="item">Invite a teammate</CollapsibleTrigger>
        </CollapsibleHeader>
        <CollapsibleContent>
          <Button size="sm" variant="outline">
            Invite
          </Button>
        </CollapsibleContent>
      </Collapsible>
    </CardContent>
  </Card>
</>
  • Fits: settings, flow: body.
  • height, width, padding, gap, corner, background, text, motion: add no class for these.

API reference

Options
OptionTypeWhat it does
inset?boolean = falseThe 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
PartWhat it is
CollapsibleHeaderThe row the trigger and its trailing control stand in
CollapsibleTriggerThe header button that folds and unfolds the content; its children are the words before its caret; variant: default (default), item; takes asChild; mark?: ReactNode — A leading glyph before the words: the caller's one element, in a 14 px box
CollapsibleActionA 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'
CollapsibleContentWhat the section shows while open; takes asChild
  • Class recipes (cva): collapsibleTriggerVariants (CollapsibleTrigger)
  • data-slot values (to select a part by): collapsible, collapsible-action, collapsible-body, collapsible-content, collapsible-header, collapsible-icon, collapsible-indicator, collapsible-indicator-box, collapsible-inset, collapsible-label, collapsible-trigger

Keyboard

KeyWhat it does
EnterActivate
SpaceActivate

Accessibility

  • The behaviour layer under the part answers keys, focus and dismissal: never write your own.
  • hover, active, focus-visible, focus-within: the browser's own (:hover, :active, :focus-visible, :focus-within): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
expandedthe attribute data-state=open
openthe attribute data-state=open
disabledthe prop disabled

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

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.

goop.so/themes/trail/components/collapsible.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-collapsible.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.