Skip to content
GitHub (opens in a new tab)

Collapsible

Single show/hide panel. The whole header row is the toggle.

stableMoleculecontracts/collapsible.json

Preview

Collapsible

Single show/hide panel. Accordion is the one-open list.

Master

The whole header row is the button. The chevron turns down when open. Not Accordion.

StatusShipped
Shipping address100 Market St, San Francisco
Items2x Studio Headphones

Usage

One panel. Click anywhere on the header row to toggle it. Use Accordion when two or more related sections fold together. Compose kit pieces in children — never a local cousin.

Do's

  • One disclosure whose body composes kit pieces
  • Order, product, or extra spec the user can hide

Don'ts

  • Two or more related sections, one open at a time — use Accordion
  • A page section that folds — use Section with collapsible
  • In-page peer views — use Tabs
<Collapsible
  trigger="Order #4189"
  open={open}
  onOpenChange={setOpen}
>
  {children}
</Collapsible>

When to use

  • One disclosure whose body composes kit pieces
  • Order, product, or extra spec the user can hide

When not to use

  • Two or more related sections, one open at a time — use Accordion
  • A page section that folds — use Section with collapsible
  • In-page peer views — use Tabs

What an agent reads

import { Collapsible } from "agentic-ds-kit";
must
  • The header row is one button with aria-expanded; its accessible name is the title
  • Button aria-controls the panel
  • Panel is role=region, aria-labelledby the header button
  • Closed panel is hidden from AT
  • Open and close glide the panel height (grid-template-rows) with a fade, on the enter / exit motion timing; the chevron turns with it. The closed panel stays mounted and inert. No motion under prefers-reduced-motion
defaults
  • defaultOpen false
stops if
  • Do not invent CollapsibleTrigger or CollapsibleContent cousins
  • Do not use Accordion for a single block
  • Do not use raw hex

From contracts/collapsible.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
triggerstringYes—Title. The whole header row is the button, with a ChevronRight before the title that turns down when open
childrenslotYes—Revealed body. Compose kit pieces, never a local cousin
defaultOpenbooleanNofalse—
openbooleanNo—controlled
onOpenChangefunctionNo—(open: boolean) => void
  • Component
    →

    Accordion

    Disclosure list for short related sections: one open at a time, or several with type multiple.

  • Component
    →

    Section

    Grouped page block with optional heading, description, and actions.

  • Component
    →

    Tabs

    Switch between related views in place.

  • Component
    →

    ContextWindow

    How full the prompt context is and what uses the space, by segment, with a warning near the limit, Trim oldest and compaction with Undo.