How to build an accessible Collapsible in React

The trigger is a native button exposing aria-expanded and aria-controls; the region is labelled by the trigger, so screen readers announce the disclosure state and target

When to use a Collapsible

When not to use it

Keyboard interactions

Role button, verified at WCAG 2.2-AA.

Common mistakes

Avoid: Stacking many Collapsibles to emulate an accordion

Prefer: Use Accordion when sections are a related set

Accordion manages single/multiple-open semantics and shared keyboard navigation

Example

<Collapsible trigger="Show details">
  <p>Hidden content revealed on toggle.</p>
</Collapsible>

See the full Collapsible reference →