This is a basic expand/collapse component controlled by a button.
It animates height, updates aria-expanded, and can be toggled with mouse, touch, or keyboard.
Tip: Press Tab to focus the button, then press Enter or Space.
Each widget is wrapped in a div.example. The controlled content container uses the details class.
This is a basic expand/collapse component controlled by a button.
It animates height, updates aria-expanded, and can be toggled with mouse, touch, or keyboard.
Because this one starts open, the script measures and sets its height on load.
aria-expanded="true"
Class: details
Q: Can the content include lists?
A: Yes. Any markup can go inside the details container.