Skip to content

Accordion ​

The bq-accordion component is a collapsible disclosure panel with a trigger button for showing and hiding content.

Basic Usage ​

html
<bq-accordion label="More information">
  <p>Hidden content that can be toggled open or closed.</p>
</bq-accordion>

Open by Default ​

html
<bq-accordion label="Details" open>
  <p>This section starts expanded.</p>
</bq-accordion>

Variants ​

html
<bq-accordion label="Default" variant="default">…</bq-accordion>
<bq-accordion label="Bordered" variant="bordered">…</bq-accordion>
<bq-accordion label="Flush" variant="flush">…</bq-accordion>

Disabled ​

html
<bq-accordion label="Unavailable" disabled>…</bq-accordion>

Properties ​

PropertyTypeDefaultDescription
labelstring—Trigger button text
openbooleanfalseWhether the panel is expanded
disabledbooleanfalseDisables interaction
variantstring'default'default | bordered | flush

Events ​

EventDetailDescription
bq-toggle{ open: boolean }Fired when the accordion is toggled

Slots ​

SlotDescription
(default)Panel content displayed when open

CSS Parts ​

PartDescription
accordionThe outer container
triggerThe toggle button
labelThe label text element
panelThe collapsible content area

Accessibility ​

  • Trigger button uses aria-expanded reflecting open/closed state
  • Trigger has aria-controls pointing to the panel's unique id
  • Panel has role="region" and aria-labelledby pointing to the trigger's unique id
  • Panel is aria-hidden="true" when collapsed
  • Keyboard support: Enter and Space on the trigger toggle the panel
  • Focus-visible styling on the trigger button

Animation ​

The accordion animates its panel with a CSS Grid grid-template-rows transition pattern instead of a fixed-height or max-height approach. Closing uses a temporary data-closing state so the panel can finish its exit animation before cleanup. The interaction also respects prefers-reduced-motion: reduce.

Released under the MIT License.