Each widget is wrapped with an element that has the “example” class, and the controlled content container has the “details” class.
Uses the built-in <details> element. The container has a details class.
This widget uses the native HTML <details> element, which provides built-in keyboard and screen reader support.
open attribute.details element.A button toggles a content region. The container for the controlled content has a details class.
This region is controlled by a button. It starts collapsed and toggles with JavaScript.
aria-controls associates the button with the region.aria-expanded reflects the current state.hidden attribute when collapsed.A hidden checkbox and label toggle the content using CSS. The container for the controlled content has a details class.
No JavaScript is required to toggle this region. CSS sibling selectors control visibility.
div with the details class.