Expand & Collapse Widgets

Explore three different approaches to reveal and conceal supplemental content, each sharing a unified “details” container class while employing unique interaction patterns.

Native <details> Element

The semantic <details> element shows how browsers natively handle disclosure widgets, complete with built-in keyboard support and toggling.

Discover how the native widget behaves

The native disclosure widget pairs a summary with additional content, letting browsers deliver accessibility, animation, and state synchronization out of the box.

  • Works without any JavaScript.
  • Automatically tracks open/closed state for assistive technology.
  • Allows nested interactive elements inside the revealed region.

Use this option when you want a lightweight, standards-based solution that gracefully degrades across environments.

Button-Powered Collapse

Custom toggles can target a dedicated content container, offering full control over animation, state, and presentation details.

Accordion with Coordinated Panels

Accordions restrict visibility to a single expanded panel at a time, helping users focus on one topic while maintaining a tidy layout.