Expand/Collapse Widgets

Examples of native and custom disclosure patterns

Native details/summary

Uses the semantic HTML details element.

What is an expand/collapse widget?

An expand/collapse widget reveals or hides supplementary content on demand. The native HTML details/summary pattern provides built‑in accessibility, keyboard support, and progressive enhancement.

  • Accessible by default
  • Works without JavaScript
  • Supports keyboard and assistive tech

Native details (open by default)

This section starts expanded using the open attribute.

Helpful tips

You can style summary to look like a button and the content region separately. The open attribute controls the initial state and can be toggled via script or user interaction.

  1. Keep summaries concise
  2. Use clear affordances
  3. Avoid hiding critical content

Custom button-controlled region

A button toggles a div with a details class and appropriate ARIA attributes.

Multiple custom regions

Each button controls its own div.details region independently.