Expand/Collapse Widgets

This page demonstrates both the native HTML details/summary and a custom button-controlled expand/collapse. Each widget is wrapped in a container with class "example", and the controlled content container has class "details".

Native details/summary

What is an expand/collapse widget?

An expand/collapse widget reveals additional content on demand. The native details element provides built‑in keyboard and screen reader support via its summary control.

Using the native element keeps markup minimal while providing accessible defaults. You can style the summary and the open state as needed.

Custom button-controlled panel

Accordion with multiple sections