base-ui-svelte

Accordion

A vertically stacked set of interactive headings that each reveal a section of content.

View as Markdown

Unstyled accessible components for design systems and apps.

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

Extends div HTML attributes.

PropertyTypeDefaultDescription
valueAccordionValue | undefinedControlled value.
defaultValueAccordionValueUncontrolled initial value.
onValueChange((value: AccordionValue) => void) | undefinedEvent handler called when the value changes.
multipleboolean
disabledbooleanfalseWhether the control ignores user interaction.
orientationAccordionOrientation'horizontal'
childrenSnippet<[{ openValues: string[] }]>Content rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-orientationThe orientation of the component.

Accordion.Header

Extends HTML element attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.

Accordion.Item

Extends div HTML attributes.

PropertyTypeDefaultDescription
valuestringControlled value.
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippet<[{ open: boolean; disabled: boolean }]>Content rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.

Accordion.Panel

Extends div HTML attributes.

PropertyTypeDefaultDescription
keepMountedboolean
rolestring | undefined
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-ending-stylePresent while the exit animation can run.
data-openPresent when the part is open.
data-starting-stylePresent while the enter animation can run.

Accordion.Trigger

Extends button HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-panel-openPresent on the element when applicable.