An expand/collapse widget lets users reveal or hide additional information on demand. The native HTML element <details> with a <summary> provides a built-in accessible option.
This example uses the details element as the container for the controlled content and adds the class details to it.
- Click the summary to toggle the content.
- Keyboard users can focus the summary and press Enter or Space.