Components / disclosure
Collapsible
One trigger, one region.
Summary
One trigger, one region.
| APG pattern | Disclosure |
| Built on | Radix |
| Status | stable |
| Since | 0.2.0 |
Use it to take something off the screen that most readers do not need.
<Collapsible summary="Advanced">…</Collapsible>
Renamed from Disclosure in 0.2.0. The APG calls the pattern disclosure and it still does — that row above is unchanged. What moved is the component's own name, because disclosure names the behavior rather than the thing, and a reader who has not read the APG cannot guess what it draws. Collapsible is what the primitive underneath is called.
The anatomy moved with it: data-se="disclosure" is now data-se="collapsible". That is the breaking half — it is what a Vue or Astro consumer writes, and there is no alias.
Anatomy
Written by hand: a <details data-se="collapsible"> with a <summary data-part="trigger"> and a data-part="content" region. The React binding renders the same parts from a Radix trigger button and content <div>, with data-state for open or closed.
| Part | Element | Required |
|---|---|---|
content | <radixcollapsible.content> | yes |
indicator | <svg> | yes |
trigger | <radixcollapsible.trigger> | yes |
Properties
| Property | Values | Default | What it does |
|---|---|---|---|
label | React.ReactNode | required | The trigger's visible text. |
open | boolean | none | Passing this makes the disclosure controlled. Without it the binding keeps its own state. (Written by hand, the native <details> form keeps its own state and needs no JavaScript.) |
defaultOpen | boolean | false | Starts open. Use it for a section most readers will want, rather than for one they must not miss — a required field inside a closed region is invisible. |
onOpenChange | (open: boolean) => void | none | Called when the reader toggles it. |
below | 'narrow' | none | narrow: above one container width the section is open and has no trigger; below it, it is a collapsible. The container is the nearest data-se-container, and with none the section is a collapsible at every width. The width is a single literal in the stylesheet. |
children | React.ReactNode | none | The region's contents. Revealed on open. When closed they stay in the DOM, hidden: a server render holds the text, find-in-page can open the region once the page has mounted, and a form control inside still submits with its form. Nothing in it can take focus until the region is open, so do not put a control the reader must reach in a section they may never open. |
States
| State | Expressed as | |
|---|---|---|
| Focused | :focus-visible | |
| Hover | :hover | |
| Open or closed | data-state |
Behavior
The hand-written form needs no script. <details> opens and closes from the platform, and find-in-page opens it.
The React binding keeps closed content in the DOM. Radix unmounts closed content by default, which left a server render empty: the text was in nothing a crawler, a reader mode or a no-JavaScript view could see. The binding mounts it and hides it. After mount it sets hidden="until-found" (React 19 renders that attribute as plain hidden, so it is set by hand), and the browser's find-in-page can open the region by firing beforematch, the way <details> behaves. A browser without until-found hides it plainly. A control inside a closed region still submits with its form but cannot take focus until the region opens.
Accessibility
The trigger is a button with aria-expanded. In the hand-written form that is <summary>, from the element; in the binding it is Radix's trigger, with aria-controls naming the content while it is open. Enter and Space work either way.
Do not hide anything the reader must act on. A required field or an error inside a collapsed region is invisible, and no amount of styling fixes that.
Keyboard
| Key | Result |
|---|---|
Enter / Space | Toggles the region — from <summary>, with no script |
Roles, states and properties
| Attribute | Set by |
|---|---|
aria-hidden | always true |
Focus
The summary is the only stop. When the region closes, focus stays on the summary rather than vanishing with the content.
Screen reader
Not recorded as verified. Stage 4 of the readiness ladder — driving each component with VoiceOver and NVDA — is unstarted across the package, and no component should claim otherwise until docs/journal/ records the session that did it.
Contrast and target size
npm run check:contrast audits every color pair this component uses across all four skins, light and dark, and fails the build on a shortfall. Two waivers are on the record in docs/audit/DEFERRED.md.
It sets no target size of its own; anything interactive inside it brings its own.
Tested
test/apg/collapsible.test.jsxtest/browser/collapsible.spec.mjstest/browser/upstream-natives.spec.mjs
Known gaps
- 3 upstream refs — their image-description example
- 5 upstream refs — a navigation disclosure set — a composition we do not ship
Appearance
| Token | Used for |
|---|---|
--se-accent-text | color |
--se-border | border-block-end |
--se-border-width | border-block-end |
--se-control-h | min-block-size |
--se-duration-fast | transition |
--se-duration-instant | transition |
--se-ease-standard | transition |
--se-focus-color | outline |
--se-focus-width | outline, outline-offset |
--se-icon-sm | block-size, inline-size |
--se-leading-body | line-height |
--se-radius-sm | border-radius |
--se-space-3 | gap, padding-block |
--se-space-4 | padding-block-end |
--se-text | color |
--se-text-muted | color |
--se-text-sm | font-size |
Width. With data-below="narrow" the section is a fixed, open part of the page above one container width and a collapsible below it: the trigger is display: none (out of the tab order and the accessibility tree) and the content shows whatever its hidden value or the <details> state says. The container is the nearest data-se-container; with none, the condition is false and the section is a collapsible at every width. A container query cannot read a custom property, so the width is a literal in the stylesheet (35rem), written once and named narrow, the way the 4/8/12 grid's breakpoint is. There is one name on purpose: a second would be a second breakpoint to keep consistent.
Motion
Height animates over --se-duration-fast when the React binding is used. Without it the region snaps, which is correct rather than degraded — a snap is the platform's answer and it is instant.
Content
The summary says what is inside, closed. Advanced, Shipping details. A summary that reads Click to expand has spent the one line the reader gets on nothing.
Usage
Reach for the React binding when you need controlled state or an animated open; otherwise <details> is less machinery for the same result.
One section, and it knows about nothing else. A disclosure has no opinion about any other disclosure on the page: no shared heading level, no rule about how many may be open, no group relationship. That is the whole difference from Accordion, and it is why three of these stacked are not an accordion — a screen-reader user hears three unrelated toggles instead of one set they can skim by heading.
Fixed above a width, a collapsible below it: data-below="narrow". The Brief folds Today and Coming up under a heading on a phone and leaves them open on a desktop. Rejected: doing it in the application with a media query and a state flag, which is the viewport breakpoint the layout part's no-breakpoints rule exists to prevent and which answers to the window, not to the column the section sits in. Rejected: a second component, because the parts, the states and the keyboard are the same.
When not to use it. For a set of sections at one heading level, use Accordion. If the sections are alternatives and only one is ever relevant, use Tabs.
Notes
This is one of two components that look like they need a binding and do not — the other is RadioGroup. A component moves up a tier by taking a native element, never by adding script to the core.