How does the native widget work?
The <details> element provides built-in expand/collapse behavior across modern browsers. Clicking the summary toggles the open state.
- No JavaScript required.
- Keyboard accessible out of the box.
- Use CSS to style the summary and content.
Learn more in the MDN docs: MDN <details>.