Expand / Collapse Widget Examples

Two accessible examples demonstrating an expand/collapse widget. Each widget is wrapped in a container with class="example" and the controlled content container uses class="details". Buttons use aria-expanded and aria-controls to reflect state.

Simple Expand / Collapse

Accordion (Single Open Item)

Tip: Use Space or Enter to toggle. In the accordion you can also use arrow keys to navigate between triggers.