Examples using native details/summary and custom JavaScript-controlled panels.
A semantic, accessible expand/collapse using the HTML details element.
An expand/collapse widget lets you reveal or hide additional information. The native HTML element for this is <details> with a <summary> label.
A button toggles a content region. The container for controlled content uses the details class.
This panel is controlled via JavaScript and the hidden attribute.
aria-expanded for accessibility.role="region" and aria-labelledby to associate the label.An accordion built with multiple details elements. Opening one closes the others.
Content for Section A. Accords restrict to a single open panel.
Content for Section B with some extra notes.
Content for Section C. Click any summary to toggle.