Accordion
We ship worldwide within 3–5 business days.
Return any item within 30 days.
A WAI-ARIA accordion with single or multiple expansion and arrow movement between headers.
Import
Section titled “Import”<script> import Accordion from "@invisible-ui/svelte/Accordion.svelte";</script><script setup> import { Accordion } from "@invisible-ui/vue";</script>import { Accordion } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-accordion></ds-accordion>In Elements:
<ds-accordion value="shipping"> <ds-accordion-item value="shipping" label="Shipping">Ships in 2-3 days.</ds-accordion-item> <ds-accordion-item value="returns" label="Returns">30-day returns.</ds-accordion-item></ds-accordion>Each <ds-accordion-item> takes value, label and disabled, and its
children are the panel content, so a panel can hold any markup.
| Prop | Type | Default | Description |
|---|---|---|---|
items * | AccordionEntry[] | — | |
value | string[] | [] | |
type | AccordionType | "single" | One open at a time, or many. |
collapsible | boolean | true | For single: allow collapsing the open item. |
disabled | boolean | false | Disable the whole accordion. |
onValueChange | ((value: string[]) => void) | undefined | undefined | Called whenever the expanded set changes. |
| Prop | Type | Default | Description |
|---|---|---|---|
items * | AccordionEntry[] | — | Ordered list of items. |
modelValue | string[] | undefined | v-model value; takes precedence over value when bound. |
value | string[] | () => [] | Expanded item values. Defaults to none. |
type | AccordionType | "single" | single (default): one open at a time. multiple: many. |
collapsible | boolean | true | For single: allow collapsing the open item. |
disabled | boolean | false | |
onValueChange | (value: string[]) => void | undefined | Called whenever the expanded set changes. |
| Event | Payload |
|---|---|
update:modelValue | value: string[] |
| Prop | Type | Default | Description |
|---|---|---|---|
items * | AccordionEntry[] | — | |
value | string[] | NONE | Initial (uncontrolled) or current (controlled) expanded values. |
type | AccordionType | "single" | single (default): one open at a time. multiple: many. |
collapsible | boolean | true | For single: allow collapsing the open item. |
disabled | boolean | false | |
headingLevel | AccordionHeadingLevel | 3 | Level of every item header, 2 to 6; an item's own headingLevel wins. |
onValueChange | (value: string[]) => void | — | Called whenever the expanded set changes. |
| Attribute | Reactive | Description |
|---|---|---|
value | yes | the expanded values, comma-separated |
type | yes | single|multiple |
collapsible | yes | single only: the open item can close; on by default, collapsible="false" turns it off |
disabled | yes | |
heading-level | yes | 2 to 6, default 3: the level of every item header; an item's own heading-level wins |
Reactive attributes re-render the element when they change after the first render.
Properties: value (string[]), items.
Emits: bubbling change CustomEvent with detail.value (string[]).
Accessibility
Section titled “Accessibility”- WAI-ARIA accordion pattern: header buttons (
aria-expanded) linked to regions, arrow/Home/End movement between headers. - The chevron points to the end of the line and mirrors in right-to-left text; open, it points down in both directions.
- For rich panel markup, drive the headless
createAccordiondirectly.
Example
Section titled “Example”<Accordion items={[ { value: "shipping", label: "Shipping", content: "Ships in 2-3 days." }, { value: "returns", label: "Returns", content: "30-day returns." }, ]}/>In React, content takes any markup, and headingLevel sets the level of the
item headers (3 by default) so they fit the page outline:
<Accordion headingLevel={2} value={open} onValueChange={setOpen} items={[ { value: "shipping", label: "Shipping", content: <ShippingTable /> }, { value: "returns", label: "Returns", content: "30-day returns." }, ]}/>Themeable via --ds-accordion-*.