Expand/Collapse Widgets

Examples of native and custom expand/collapse controls.

Native details/summary

What is an expand/collapse widget?

An expand/collapse widget lets users reveal or hide additional information on demand, helping reduce visual clutter.

  • Uses the HTML details/summary elements.
  • Works without JavaScript.
  • Accessible by default with keyboard and screen readers.

Custom button controls panel

Accordion (only one section open)

This section starts expanded. Clicking another header will collapse it.

Nested content inside native details

Frequently Asked Questions
Can I nest collapsible sections?

Yes. Native details elements can be nested, though keep the hierarchy simple to avoid confusion.

Will this work without JavaScript?

Native details/summary works without JavaScript. Custom panels use minimal JavaScript to toggle visibility.