Accordion
A stack of headings reveals related sections. Several sections can be open together.
Example
Choose a payment method at checkout.
Keyboard interaction
Enter or Space toggles a section. Up/Down, Home, and End move between its heading buttons.
Events
Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.
axxy-accordion-change— Dispatched when an accordion section expands or collapses. (target:Header <button>, detail:{ expanded: boolean, trigger: HTMLElement, panel: HTMLElement })
Example HTML
<axxy-scope>
<section aria-label="Checkout details" aria-roledescription="accordion">
<h2>
<button aria-expanded="true">Personal information</button>
</h2>
<div>
<label>
Name
<input autocomplete="name">
</label>
</div>
<h2>
<button>Delivery address</button>
</h2>
<div>
<label>
Address
<input autocomplete="street-address">
</label>
</div>
<h2>
<button>Payment details</button>
</h2>
<div>
<p>Choose a payment method at checkout.</p>
</div>
</section>
</axxy-scope>