Expand/Collapse Widgets

Three examples: native details/summary, a button-controlled panel, and a multi-item accordion. Each content container uses the class details.

1) Native details/summary

About this section

This uses the built-in HTML <details> and <summary> elements. The content below is the controlled area wrapped by a container with class details.

  • Click the summary row to expand or collapse.
  • Keyboard accessible by default: Space/Enter toggles.
  • You can nest any HTML content inside.

2) Button-controlled panel

(ARIA attributes keep assistive tech in sync.)

3) Accordion (single open item)