Accordions
What are your shipping options?
What is your return policy?
How can I contact customer support?
<section class="accordion">
<details open>
<summary>
What are your shipping options?
<i class="icon icon-chevron-down" aria-hidden="true"></i>
</summary>
<section>We offer standard (5-7 days), express (2-3 days), and overnight shipping. Free shipping on international orders.</section>
</details>
<details>
<summary>
What is your return policy?
<i class="icon icon-chevron-down" aria-hidden="true"></i>
</summary>
<section>You can return items within 30 days of delivery. Items must be unused and in their original packaging.</section>
</details>
<details>
<summary>
How can I contact customer support?
<i class="icon icon-chevron-down" aria-hidden="true"></i>
</summary>
<section>Email support@example.com or use live chat during business hours.</section>
</details>
Usage
Is it accessible?
<section class="accordion">
<details open>
<summary>
Is it accessible?
<i class="icon icon-chevron-down" aria-hidden="true"></i>
</summary>
<section>Yes. It uses native disclosure semantics.</section>
</details>
API Reference
Attributes
| Attribute | On | Values | Default | Description |
|---|---|---|---|---|
| data-multiple | .accordion | present or absent | absent | Lets several items stay open. Without it, opening one closes the others. |
| open | details | present or absent | absent | The item is open. The browser sets and removes it; write it to start an item open. |
| aria-disabled | details or its summary | "true" | none | The item cannot be opened or closed. |
Events
| Event | On | Detail | Description |
|---|---|---|---|
| toggle | details | none | The browser's own event, sent when an item opens or closes. It does not bubble. |
Keyboard
| Key | Description |
|---|---|
| Enter or Space | On a summary: opens or closes its item. This is the browser's own behaviour for details. |
The accordion has no methods of its own. Open or close an item by setting open on its details element.
Once the script has started it, the element carries data-accordion-initialized="true" and sends tsugi:initialized. The methods and properties above are on the element itself.