Expand / Collapse (Accessible) — Examples

This example starts expanded. The JavaScript sets inline max-height values to produce a smooth height transition based on the content's scrollHeight. Resizing the window updates heights for any open panels.

Because the control is a native button, it automatically supports Space/Enter activation and remains keyboard-accessible.