Expand/Collapse Widgets

Examples of native and scripted expand/collapse interactions. Each widget is wrapped in an element with class "example", and controlled content containers use the "details" class.

Native HTML Details

What is an expand/collapse widget?

An expand/collapse widget lets you show or hide additional information on demand. The native HTML <details> element provides built-in semantics, keyboard support, and accessibility.

  • Click or press Enter/Space on the summary to toggle.
  • Use it for FAQs, progressive disclosure, and long explanations.
  • It degrades gracefully if scripting is disabled.

Button-Controlled Panel

Accordion (One Panel Open)