Expand / Collapse widget examples

Accessible widgets that toggle visibility of a content region. Each widget is wrapped by a div.example and the controlled content container uses the details class.

Collapsible (initially closed)
Expanded (initially open)

Explanation: This example starts expanded. The script will set the measured max-height so the animation looks smooth. When open, the details element gets the open class so CSS can style it differently (for instance, changing opacity).

<button aria-expanded="true" aria-controls="details-2">...</button>

Notes: Buttons manage aria-expanded and the panels use the details class as requested. The script ensures smooth height transitions and proper a11y attributes.