What is an expand/collapse widget?
It’s a UI component that shows or hides content when activated. This example adds a smooth animation for opening and closing.
Is it accessible?
Yes. The button uses aria-expanded and aria-controls, and the controlled region is identified with aria-labelledby. The content is hidden using the hidden attribute, which removes it from the accessibility tree when collapsed.
Can I make multiple sections?
Absolutely. Add more toggles that point to their own containers with the "details" class.