Expand/Collapse Widget Demonstration

This page shows different patterns for expand/collapse widgets. Each widget is wrapped with a container having the "example" class, and the container for controlled content uses the "details" class.

Native HTML details/summary

What is an expand/collapse widget?

An expand/collapse widget hides non-critical content until the user chooses to reveal it. The native HTML details/summary pattern provides built-in accessibility and toggling behavior without JavaScript.

  • Click the summary row to expand or collapse.
  • Keyboard users can focus the summary and press Space/Enter.
  • Screen readers announce the expanded/collapsed state.

Custom button controls a content panel

Collapsed

Accordion with single-open behavior