API Reference
Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.
Accordion.Root
Groups all parts of the accordion. Renders a <div> element.
Props
defaultValue AccordionValue —
- Name
defaultValue- Description
Uncontrolled initial value.
- Type
AccordionValue
onValueChange function —
- Name
onValueChange- Description
Event handler called when the value changes.
- Type
((value: AccordionValue) => void) | undefined
multiple boolean false
- Name
multiple- Description
Whether multiple items can be open at the same time.
- Type
boolean- Default
false
disabled boolean false
- Name
disabled- Description
Whether the control ignores user interaction.
- Type
boolean- Default
false
orientation AccordionOrientation 'horizontal'
- Name
orientation- Description
Deprecated following the [APG guidance update](https://github.com/w3c/aria-practices/pull/3434) to remove roving focus. This prop no longer affects keyboard focus behavior.
- Type
AccordionOrientation- Default
'horizontal'
Data attributes
| Attribute | Description |
|---|---|
data-disabled | Present when the accordion is disabled. |
data-orientation | Indicates the orientation of the accordion. |
Accordion.Header
A heading that labels the corresponding panel. Renders an <h3> element.
Props
Accordion.Item
Groups an accordion header with the corresponding panel. Renders a <div> element.
Props
disabled boolean false
- Name
disabled- Description
Whether the control ignores user interaction.
- Type
boolean- Default
false
onOpenChange function —
- Name
onOpenChange- Description
Event handler called when the open state changes.
- Type
((open: boolean, eventDetails: { reason: 'trigger-press' | 'imperative' }) => void) | undefined
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-disabled | Present when the accordion item is disabled. |
data-open | Present when the accordion item is open. |
Accordion.Panel
A collapsible panel with the accordion item contents. Renders a <div> element.
Props
keepMounted boolean false
- Name
keepMounted- Description
Whether to keep the element in the DOM while the panel is closed. This prop is ignored when
hiddenUntilFoundis used.- Type
boolean- Default
false
boolean false
- Name
hiddenUntilFound- Description
Use the
hidden="until-found"attribute when collapsed.- Type
boolean- Default
false
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-ending-style | Present when the panel is animating out. |
data-open | Present when the accordion panel is open. |
data-starting-style | Present when the panel begins animating in. |
Accordion.Trigger
A button that opens and closes the corresponding panel. Renders a <button> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-disabled | Present when the accordion item is disabled. |
data-panel-open | Present when the accordion panel is open. |