Expand/Collapse Widget Demonstration

Examples showing native and custom expand/collapse behaviors. Each widget is wrapped in a container with class example, and the controlled content uses a container with class details.

Native details (collapsed by default)

What is an expand/collapse widget?

An expand/collapse widget reveals additional content on demand. This native example uses the HTML <details> element with a <summary> as the toggle.

Native details (open by default)

Default open state

This section starts expanded using the open attribute. Click the summary to collapse it.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer in dui vel arcu fermentum dictum. Phasellus non diam at lorem porta tristique.

Custom button-controlled content