Skip to content

Accordion

Accordion container plus item element for expandable content sections.

Live Preview
import '@bnotk/dsx/components/accordion.js';
<dsx-accordion variant="card">
<dsx-accordion-item header="General" expanded>
<p>General section content.</p>
</dsx-accordion-item>
<dsx-accordion-item header="Advanced" removable>
<p>Advanced section content.</p>
</dsx-accordion-item>
</dsx-accordion>

Container that coordinates one or more <dsx-accordion-item> elements.

PropertyTypeDefaultDescription
multiplebooleanfalseAllows more than one item to stay expanded at the same time.
variant’default’ | ‘card''default’Adds the card-like slotted styling variant when set to card.

None.

None.

SlotDescription
defaultAccordion items (<dsx-accordion-item>).

This element does not expose shadow parts.

  • Listens for bubbled dsx-expand events from child items.
  • When multiple is false, expanding one item sets expanded = false on every other item in the light DOM.

Single collapsible panel with header text, optional custom header content, and optional remove action.

PropertyTypeDefaultDescription
headerstringPlain-text header label rendered before the named header slot.
expandedbooleanfalseShows the content region and rotates the chevron when true.
removablebooleanfalseShows a trailing remove button in the header.

None.

EventDetailDescription
dsx-expandBubbles/composed when the item is expanded.
dsx-collapseBubbles/composed when the item is collapsed.
dsx-removeBubbles/composed when the remove button is clicked.
SlotDescription
defaultPanel body content.
headerAdditional inline header content appended after the header property text.

This element does not expose shadow parts.

  • The header wrapper uses role="button" and updates aria-expanded from the expanded state.
  • The remove button stops propagation so clicking it does not also toggle the panel.
  • Accordion items are stacked with a shared border seam created by margin-top: -1px on non-first items.
  • The chevron rotates 90 degrees when expanded is true.
  • The card variant styles slotted items from the container with extra radius, margin, and a subtle shadow.
  • Uses --ds2-color-grey-*, --ds2-color-white, and --ds2-border-radius tokens for borders and surfaces.
  • Header hover state uses --ds2-color-grey-1; remove hover uses --ds2-color-error.