Content
Disclosure
Content that opens on request, alone or as an accordion, on native details and summary.
- Experimental
- Keyboard tested
- Screen reader not tested yet
Playground
Change the props. The controls come from the documented props.
Can I change a token myself?
Propose it: every token change runs through the contrast gate first.
<Disclosure title="Can I change a token myself?">
Propose it: every token change runs through the contrast gate first.
</Disclosure>Usage
When to use
Use a disclosure for content that only some people need: answers in an FAQ, details behind a summary, the fine print of a process.
When not to use
- For content most people need: show it.
- For switching between views of the same content: use Tabs.
- For a short explanation next to a term: use Popover.
How it works
Native details and summary: it works without JavaScript and the browser still finds text inside closed panels. The chevron turns when open. Disclosures with the same name form an accordion where one opens at a time.
Content guidelines
Titles are the questions people actually ask, in their words. The answer starts with the answer, not with a repetition of the question.
Do and don’t
Do
- Write titles as the question people actually ask.
- Use name for an FAQ where one open answer at a time keeps the overview.
Don’t
- Don't hide content most people need; show it.
- Don't nest disclosures.
Anatomy
The parts of the component and what each one does, as in the playground above.
- triggersummary with the title and a chevron that turns when open.
- panelThe content, in secondary text.
- separatorHairline below each disclosure.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { Disclosure } from "@/ds";
FAQ, one open at a time
Does the AI write its own components?
No. It composes screens from the components in the manifest. When something is missing, it reports the gap instead of building it.
What makes a generated screen done?
A green npm run check: contrast, types, lint, build, axe, keyboard tests and every declared state, at desktop and phone width.
Who decides what stays?
A person looks at the screenshots of every result and decides. The machine proposes, the human decides.
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| title (required) | string | – | The question or topic; always visible. |
| children (required) | ReactNode | – | The content that opens. |
| defaultOpen | boolean | false | Open on first render. |
| name | string | – | Shared name: disclosures with the same name open one at a time. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| button.radius | component | 9999px | |
| disclosure.border | component | rgba(10,10,11,0.08) | |
| disclosure.icon | component | #555555 | |
| focus | semantic | #C6492E | |
| motion.duration.fast | semantic | 150ms | |
| motion.ease.out | semantic | cubic-bezier(0.16, 1, 0.3, 1) | |
| spacing.4 | semantic | 16px | |
| spacing.6 | semantic | 24px | |
| surface.page | semantic | #FAFAF7 | |
| text.primary | semantic | #0A0A0B | |
| text.secondary | semantic | #555555 | |
| weight.semibold | semantic | 600 |
Accessibility
What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Tested |
| Screen reader | Manual | Not tested yet |
Keyboard
| Key | Action |
|---|---|
| Tab | Moves to the next disclosure title. |
| Enter / Space | Opens or closes it. |
Semantics and focus
- Native details/summary: the browser announces expanded and collapsed, Enter and Space toggle.
- Text inside closed disclosures is still found by the browser's find in page.
Contrast
| Pairing | Ratio (x:1) | Minimum | Status |
|---|---|---|---|
| text.primary on surface.page | 18.92 | 4.5 | Pass |
| text.secondary on surface.page | 7.13 | 4.5 | Pass |
| focus on surface.page | 4.57 | 3.0 | Pass |