Expand / Collapse Widget Examples

Each widget is wrapped in a div.example. The controlled content container uses the class "details". Click the buttons to toggle the content.

More information

This is additional information that can be shown or hidden. The container has the class "details" and is controlled by the button above via aria-controls. The expand/collapse animation is handled with a smooth transition.

Initially expanded

This example starts expanded. The script initializes each details container to either the expanded or collapsed state based on the button's aria-expanded attribute. Try collapsing and expanding again to see the animation.

Accordion group

Demo of multiple widgets

Short blurb about topic A.

Details for topic B are revealed here.

Extra content for topic C.