Skip to content

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.
tsx
<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.
  1. triggersummary with the title and a chevron that turns when open.
  2. panelThe content, in secondary text.
  3. 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.
Disclosure props
NameTypeDefaultDescription
title (required)string–The question or topic; always visible.
children (required)ReactNode–The content that opens.
defaultOpenbooleanfalseOpen on first render.
namestring–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.
Tokens used by Disclosure
TokenTierValueUtility
button.radiuscomponent9999px
disclosure.bordercomponentrgba(10,10,11,0.08)
disclosure.iconcomponent#555555
focussemantic#C6492E
motion.duration.fastsemantic150ms
motion.ease.outsemanticcubic-bezier(0.16, 1, 0.3, 1)
spacing.4semantic16px
spacing.6semantic24px
surface.pagesemantic#FAFAF7
text.primarysemantic#0A0A0B
text.secondarysemantic#555555
weight.semiboldsemantic600

Accessibility

What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
Testing status by check
CheckHowStatus
axe-core rulesAutomated on every npm run check, at desktop and mobile widthRuns on every build
KeyboardAutomated Playwright test (scripts/keyboard.mjs)Tested
Screen readerManualNot tested yet

Keyboard

Disclosure keyboard interactions
KeyAction
TabMoves to the next disclosure title.
Enter / SpaceOpens 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

Disclosure contrast pairings
PairingRatio (x:1)MinimumStatus
text.primary on surface.page18.924.5Pass
text.secondary on surface.page7.134.5Pass
focus on surface.page4.573.0Pass