Click the headers below to expand or collapse content. Use the toolbar to control them programmatically.
An expand/collapse widget reveals additional content when activated. This example uses the native HTML <details> and <summary> elements for accessibility and simplicity.
This widget includes the open attribute, so it starts expanded.
open to pre-expand important informationYou can include any HTML inside the panel, like lists, paragraphs, and inline code.
<ul>/<ol> to organize contentFor example, toggling with JavaScript:
const d = document.querySelector('details.details');
d.open = !d.open;
Rich content
In an accordion, opening one item closes the others in the same group.
AccordionThis second item opens by closing the others.
AccordionOnly one item remains open within this group.
AccordionThis widget can be toggled programmatically using the button outside.
External control