Expand/Collapse Widgets

Below are different expand/collapse widgets. Each widget is wrapped in a container with an "example" class. The controlled content container uses the "details" class.

Native HTML details/summary

Uses the built-in details element with a summary.

What is contained in this section?

This content is revealed using the native HTML details/summary element.

  • It is keyboard-accessible by default.
  • It can be nested within other content easily.
  • Screen readers announce its expanded/collapsed state.

Button-controlled region

A button toggles visibility of a controlled content container.

Accordion (single-open)

Only one section opens at a time in this group.