When to use
- You require a mutually exclusive optional or secondary block of content on a page (e.g. AI reasoning, advanced settings, an explanation, a preview).
- When the content is useful but not essential to the primary task.
- Expanding additional details for a single item, such as an expandable table row or a single product detail card.
When to use something else
- Multiple stacked expandable sections: use Accordion instead.
- Navigation or filtering: use Tabs or filter controls (Combobox, Select, etc.).
- Use a Tooltip or Popover for short, temporary visual explanations that floatingly overlay content without pushing surrounding elements down.
- Content the user almost always needs: show it by default as regular text; don’t hide it in a collapsible.
Dos and don’ts
- Do default to collapsed unless the collapsible content is the main purpose of the view.
- Do keep the trigger label descriptive — it should communicate what’s inside, not just say “See more”.
- Do reserve space or animate layout reflow smoothly to prevent sudden visual jumps for the user.
- Don’t nest Collapsibles — if you need layered disclosure, reconsider the information architecture.
- Don’t use it to hide errors, critical or required information or CTAs inside.
Behavior
- One trigger expands or collapses a single associated region; animation is optional but state (expanded/collapsed) must be exposed to assistive tech when it conveys meaning.
- Collapsibles directly push down subsequent inline content upon expansion and pull it back up upon collapse without changing parent layout boundaries.
Often used with
Separator when stacking multiple collapsible regions on one page.Accessibility
- Trigger attributes: Ensure disclosure triggers are semantic
<button>elements witharia-expanded="true|false"linked to the expandable container id viaaria-controls. - Focus retention: Do not automatically shift focus into the revealed content container upon expansion unless it contains immediate form fields requiring user input.