Expand/Collapse Widget Demo

Two examples: a custom button controlling a region, and a native <details>. Each widget is wrapped in a div.example, and the controlled content container uses the details class.

Custom widget (button + controlled region)
Native widget (<details>)
Show details Native disclosure
This uses the browser’s native disclosure element. The controlled content is wrapped in a div.details for consistent styling and structure.
Open/close state is handled by the open attribute automatically.