Accordion

Vertically stacked panels that expand to reveal content, with one or several items open at a time and full keyboard navigation.

import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@plexui/vue/components/Accordion";

Compose with AccordionItem, AccordionTrigger, and AccordionContent. Built on Reka UI Accordion, with the same keyboard navigation, focus management, and WAI-ARIA semantics as the React version.

Examples

Overview

Single

Multiple

Disabled

Card

API

Accordion

PropTypeDefaultDescription
type"single" | "multiple"Required. Whether one item or many can be open at a time
v-model:value / valuestring | string[]Controlled open item(s), named like the React prop
default-valuestring | string[]Uncontrolled initial open item(s)
collapsiblebooleanfalseWhen type="single", allow closing the open item
disabledbooleanfalseDisable every item
dir"ltr" | "rtl""ltr"Reading direction
orientation"horizontal" | "vertical""vertical"Layout axis
classstringApplied to the root <div>
@update:value(value: string | string[]) => voidFires when the open item(s) change; closing the open item of a single accordion reports ""

AccordionItem

PropTypeDefaultDescription
valuestringRequired. Unique identifier used by value / default-value
disabledbooleanfalseDisable this item
classstringApplied to the item wrapper

AccordionTrigger

Renders a <button> inside an <h3> header, with a chevron that rotates when the item opens. The default slot is the label; class, other attributes, and listeners such as @click go to the <button>.

AccordionContent

Renders the collapsible panel; the default slot is its content. It sets --radix-accordion-content-height (the same variable as React, so the shared CSS animates both) to interpolate the open/close animation from 0 to the measured content height. force-mount keeps a closed panel mounted and visible for custom animations.

Styling

Colors, spacing, and transitions are controlled by component tokens:

  • --accordion-item-divider-color: border between items (defaults to --color-border)
  • --accordion-item-divider-width: divider thickness (defaults to 1px)
  • --accordion-item-disabled-opacity: disabled item opacity (defaults to 0.5)
  • --accordion-trigger-color: trigger text color
  • --accordion-trigger-font-size / --accordion-trigger-font-weight / --accordion-trigger-line-height: trigger typography
  • --accordion-trigger-padding-block: trigger vertical padding
  • --accordion-trigger-gap: space between label and chevron
  • --accordion-trigger-focus-ring-color: focus ring color
  • --accordion-icon-color / --accordion-icon-size: chevron color and size
  • --accordion-content-color / --accordion-content-font-size / --accordion-content-line-height: content typography
  • --accordion-content-padding-bottom: space between content text and the next divider
  • --accordion-transition-duration / --accordion-transition-ease: open/close animation

Override at any scope to tune the look:

.my-faq {
  --accordion-trigger-font-size: var(--font-text-base-size);
  --accordion-item-divider-color: var(--color-border-strong);
}