Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

Accordion

Collapsible sections, one at a time or many.

import { Accordion } from '@loidolt/theme-svelte';

Example

3mm birch ply, grain running along the long edge.

Notes

  • Keep headingLevel in step with the surrounding outline: panels sit one level below the heading that introduces them.

Props

Generated from the component source, so it cannot drift from the implementation.

Accordion props
PropTypeDefaultNotes
children required Snippet<[{ value: T }]>—Panel body, rendered for each item with the item's own value.
items required Disclosure<T>[]—
class string—
contentClass string—
disabled booleanfalse
headingLevel HeadingLevel3Heading level of every trigger's wrapper. Panels sit at one level below whatever heading introduces the accordion, so keep this in step with the surrounding outline.
id string—Narrowed from the DOM attribute: the Bits root this spreads onto rejects null.
itemClass string—
multiple booleanfalseLets more than one panel stay open. value is then an array.
onValueChange (value: T | T[]) => void—
ref bindableHTMLDivElement | nullnull
value bindableT | T[]—Open panel, or panels when multiple. Bindable.

Plus the attributes of Omit<HTMLAttributes<HTMLDivElement>, 'children'>, forwarded to the root element.