component

Accordion

props · 30 shown · 31 total

Accordion

State

  • AccordionItemValue[]

    Uncontrolled initial list of expanded item values.

  • boolean
    default false

    Disable the entire accordion and all its items.

  • AccordionItemValue[]

    Controlled list of expanded item values. Bind this prop to track or set expansion state externally.

Appearance

  • "transparent" "surface.peak" "surface.hill" "surface.base" "surface.valley" "surface.ground"
    default surface.peak

    Surface level for each item's Panel background. Inherited by all items unless overridden per-item.

  • "none" "default" "bold" "muted" "accent"
    default muted

    Box-shadow ring border applied to each item. Uses box-shadow so it is layout-neutral.

  • false CardFrameProps<unknown>
    default false

    Frame the whole group in a Card: the group `heading` / `subheading` / `leading` / `trailing` actions go in the card header, an optional `footer` under the items, and the items become flush rows of the card's content (edge to edge by default; `contentBackground` puts them on an inset panel). Items keep their disclosure pattern — they never become cards. Unset or `false` renders the bare accordion (no Card). In card mode the accordion-level `size`, `background`, `border`, `radius` and `feedback` become the card's defaults.

  • "primary" "secondary" "tertiary"

    Visual emphasis applied to each item's Panel. `primary` is a solid feedback accent surface with contrast text; `secondary` is a feedback-tinted soft surface (default); `tertiary` is a neutral surface with bold feedback-tinted text. Inherited by all items unless overridden per-item.

  • "inherit" "danger" "neutral" "primary" "success" "warning"

    Semantic feedback color applied to each item's Panel background. Inherited by all items unless overridden per-item.

  • "lg" "md" "sm" "2xl" "xl" "xs" "none" "10xl" "11xl" "2xs" "3xl" "3xs" "4xl" "4xs" "5xl" "6xl" "7xl" "8xl" "9xl"
    default none

    Internal padding for each item's Panel. Inherited by all items unless overridden per-item.

  • "lg" "md" "sm" "inherit" "2xl" "xl" "xs" "none" "2xs" "3xl" "4xl" "5xl" "6xl" "inner" "full"
    default sm

    Border radius for each item's Panel. Inherited by all items unless overridden per-item.

  • "lg" "md" "sm" "inherit" "2xl" "xl" "xs" "none" "2xs" "3xl" "4xl" "5xl" "6xl" "inner" "full"

    Border radius for the bottom corners of each item's Panel.

  • "lg" "md" "sm" "inherit" "2xl" "xl" "xs" "none" "2xs" "3xl" "4xl" "5xl" "6xl" "inner" "full"

    Border radius for the left corners of each item's Panel.

  • "lg" "md" "sm" "inherit" "2xl" "xl" "xs" "none" "2xs" "3xl" "4xl" "5xl" "6xl" "inner" "full"

    Border radius for the right corners of each item's Panel.

  • "lg" "md" "sm" "inherit" "2xl" "xl" "xs" "none" "2xs" "3xl" "4xl" "5xl" "6xl" "inner" "full"

    Border radius for the top corners of each item's Panel.

  • "lg" "md" "sm"
    default "md"

    Controls trigger padding, content padding, and font size for all items.

Behavior

  • boolean
    default true

    In `single` mode, allow the open item to be collapsed back to nothing. Has no effect in `multiple` mode.

  • (value: AccordionItemValue[]) => void

    Callback fired whenever the expanded set changes.

  • "single" "multiple"
    default "single"

    Expansion behavior. `single` allows one item open at a time and collapses siblings; `multiple` allows any number of items to be open simultaneously.

Accessibility

  • 2 3 4 5 6
    default 3

    Document outline level of the heading wrapping the trigger (`3` → `<h3>`). Nested in an `<Accordion>`, the root's `itemHeadingLevel` is the default.

Slots

  • children slot svelte
    Snippet

    Slot children (nested `<AccordionItem>`s). Ignored when `items` is set.

  • AccordionItemData[]

    When provided, `<Accordion>` renders one `<AccordionItem>` per entry, applying root-level style props as defaults and letting each entry override them. Mutually exclusive with slot children (items wins, slot is ignored with a console warning in dev).

  • snippets slot svelte
    Record<string, Snippet<[]>>

    Programmatic snippet map for items-array mode. Keys are item `value`s, values are snippets rendered as the body of each item. Alternatively, declare inline snippets whose names match the item values as children of <Accordion> — those are captured automatically.

Advanced

  • element binding svelte
    HTMLDivElement null

    Bound reference to the accordion root (`bind:this`) — the item stack, which sits inside the Card's content when `card` is set.

  • AccordionPassThrough< RootElementAttributes, ItemElementAttributes, TriggerElementAttributes, IndicatorElementAttributes, ContentElementAttributes, HeaderElementAttributes, HeadingElementAttributes, ActionsElementAttributes, ContentInnerElementAttributes, ContentBodyElementAttributes >

    Per-slot style and attribute override bag. Applies to all items.

  • boolean
    default false

    Astro / vanilla: serialize the props into `data-accordion-config` so the client runtime hydrates this instance and `getPindoba(el, "accordion")` can `update()` it. Astro sets it on every instance (an accordion is interactive by nature). Frameworks with their own reactivity don't need it.

Plus all standard <div> HTML attributes.

AccordionItem

State

  • boolean
    default false

    Disable this individual item, preventing interaction.

  • boolean
    default false

    Whether the item is open. Drives `aria-expanded`, `data-state`, and the collapsed-panel `hidden="until-found"` (which keeps the body findable by the browser's find-in-page). In Svelte this is controlled via the root accordion's `value` prop.

Behavior

  • value required
    AccordionItemValue

    Unique identifier for this item within the accordion. Used to track expansion state.

Accessibility

  • 2 3 4 5 6
    default 3

    Document outline level of the heading wrapping the trigger (`3` → `<h3>`). Nested in an `<Accordion>`, the root's `itemHeadingLevel` is the default.

Advanced

  • { item?: AccordionSlotPassThrough<ItemElementAttributes>; header?: AccordionSlotPassThrough<HeaderElementAttributes>; heading?: AccordionSlotPassThrough<HeadingElementAttributes>; trigger?: AccordionSlotPassThrough<TriggerElementAttributes>; indicator?: AccordionSlotPassThrough<IndicatorElementAttributes>; actionsLeading?: AccordionSlotPassThrough<ActionsElementAttributes>; actionsTrailing?: AccordionSlotPassThrough<ActionsElementAttributes>; content?: AccordionSlotPassThrough<ContentElementAttributes>; contentInner?: AccordionSlotPassThrough<ContentInnerElementAttributes>; contentBody?: AccordionSlotPassThrough<ContentBodyElementAttributes>; }

    Per-slot style and attribute override bag for this item. Takes precedence over the root accordion's `passThrough`.

  • boolean
    default false

    Astro / vanilla: serialize the props into `data-accordion-item-config` so the client runtime hydrates this item and `getPindoba(el, "accordion-item")` can `update()` it. Astro sets it on every item. Frameworks with their own reactivity don't need it.

Type

  • Components
  • Blocks