This is a simple expand/collapse component using a button to toggle a content panel.
The button updates aria-expanded and the panel uses role="region".
Tip: Press Tab to focus the button, then press Enter or Space.
Each example below is wrapped in a div.example. The controlled content container uses the details class.
Buttons include ARIA attributes for accessibility.
This is a simple expand/collapse component using a button to toggle a content panel.
The button updates aria-expanded and the panel uses role="region".
Tip: Press Tab to focus the button, then press Enter or Space.
Common items:
You can use the same pattern for multiple panels. Each button targets a unique
div.details via aria-controls.