Expand/Collapse Widgets

Examples of native and custom expand/collapse interactions. Each widget is wrapped in an element with the example class, and the container for controlled content has a details class.

Native details/summary

More information

This uses the HTML <details> and <summary> elements.

It supports keyboard and mouse out-of-the-box and can be styled to fit your UI.

Because the container is the details element itself, it has the details class.

Custom button toggle

Accordion (single-open)