Back to catalog
Component detail entry
Data Display
@vean/ui
SAccordion

Accordion

Accordion belongs to the Data Display category. Start with demos and usage, then use the API tables to finish integration and styling decisions.

Use the quick jump panel to reach overview, usage, demos, and API first, then continue through the full page.

Quick jump

Related components

If you are composing interactions in the same family, these components usually pair well together.

Accordion

Overview

A vertically (or horizontally) stacked set of interactive headings that each reveal a section of content, supporting single or multiple expansion. SAccordion combines an AccordionRoot/AccordionItem/AccordionHeader/AccordionTrigger/AccordionContent/AccordionDescription family of Aria primitives (zero styles) with the accordionVariants style recipe (8 slots, 6 sizes).

Use it for FAQs, settings groups, collapsible navigation, or any “expand to reveal” pattern where one (or several) sections should be open at a time. Prefer tabs when only one panel should be visible at once and each panel has a persistent label, and collapsible for a single standalone foldable section.

SAccordion aggregates the primitives through AccordionCompact and is items-driven with item/leading/title/trigger-icon/content slots. For fully custom compositions, fall back to the Aria AccordionRoot-family primitives.

Usage

Features

  • 🧩 Aria/styled split — AccordionCompact aggregates the 6 primitives and is items-driven; SAccordion only injects styles and forwards slots/events
  • 🎚️ Single / multiple — multiple toggles one-open vs many-open (M extends boolean generic); collapsible allows all sections closed
  • ⌨️ Keyboard navigation — arrow keys move between triggers (useArrowNavigation), respecting orientation and dir; triggers expose aria-expanded/aria-disabled/data-state
  • 🧭 Orientation — vertical (default) or horizontal
  • ⛔ Disabled items — per-item disabled and root disabled propagation
  • 🎨 6 sizes — xs–2xl size matching ThemeSize
  • 🔧 Fully customizable — as/asChild on the trigger, leading/title/trigger-icon/content/item slots, and per-slot ui overrides
  • ♿ Accessible by default — real <button> triggers with aria-expanded, collapsible animation via data-state, and axe-core zero violations

Component family

  • SAccordion (styled) — the entry wrapper; accordionVariants recipe with dynamic slot forwarding
  • AccordionRoot (Aria) — the state owner; useSelection manages single/multiple modelValue, exposes dir/orientation
  • AccordionItem (Aria) — one section; derives its open/disabled state from the root and wires arrow-key navigation
  • AccordionHeader (Aria) — the header container for the trigger
  • AccordionTrigger (Aria) — the <button> trigger; aria-expanded/aria-disabled/data-state and click-to-toggle
  • AccordionContent (Aria) — the animated collapsible content (CollapsibleContent)
  • AccordionDescription (Aria) — the default description text inside content
  • AccordionCompact (Aria) — the aggregated composite; iterates items into items and exposes the customization slots

Demos

Basic

Custom Icon

Custom Styling

API

Aria Layer

8

Accordion<T, M>

18 Props1 Emits5 Slots
Props
PropTypeDefaultDescription
class
ClassValue
—
root class
size
ThemeSize
—
Visual size of the component.
ui
Partial<AccordionUi>
—
Per-slot class overrides for the component.
items
T[]
—
Items rendered by the component.
itemProps
AccordionItemProps
—
Properties forwarded to the item element.
headerProps
AccordionHeaderProps
—
Properties forwarded to the header element.
triggerProps
AccordionTriggerProps
—
Properties forwarded to the trigger element.
contentProps
AccordionContentProps
—
Properties forwarded to the content element.
descriptionProps
AccordionDescriptionProps
—
Properties forwarded to the description element.
collapsible
boolean
false
When type is "single", allows closing content when clicking trigger for an open item. When type is "multiple", this prop has no effect.
dir
Direction
'ltr'
The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.
disabled
boolean
false
When `true`, prevents the user from interacting with the accordion and all its items
orientation
DataOrientation
'vertical'
The orientation of the accordion.
unmountOnHide
boolean
`true`
When `true`, the element will be unmounted on closed state.
modelValue
(M extends true ? string[] : string)
—
The controlled value of the selected item(s). Use this when you need to control the state of the items. Can be bound with `v-model`
defaultValue
(M extends true ? string[] : string)
—
The default value of the selected item(s). Use this when you need to set the initial state of the items.
multiple
M
—
Determines whether a "single" or "multiple" items can be selected at a time. This prop will overwrite the inferred type from `modelValue` and `defaultValue`.
selectionBehavior
SelectionBehavior
'toggle'
How multiple selection should behave in the collection.
Emits
Emit NameParametersDescription
update:modelValue
M extends true ? string[] : string
—
Slots
Slot NameParametersDescription
item
AccordionCompactSlotProps<T, M>
Custom content for the item slot.
leading
AccordionCompactSlotProps<T, M>
Custom content for the leading slot.
title
AccordionCompactSlotProps<T, M>
Custom content for the title slot.
trigger-icon
AccordionCompactSlotProps<T, M>
Custom content for the trigger icon slot.
content
AccordionCompactSlotProps<T, M>
Custom content for the content slot.

AccordionCompact<T, M>

15 Props1 Emits5 Slots
Props
PropTypeDefaultDescription
items
T[]
—
Items rendered by the component.
itemProps
AccordionItemProps
—
Properties forwarded to the item element.
headerProps
AccordionHeaderProps
—
Properties forwarded to the header element.
triggerProps
AccordionTriggerProps
—
Properties forwarded to the trigger element.
contentProps
AccordionContentProps
—
Properties forwarded to the content element.
descriptionProps
AccordionDescriptionProps
—
Properties forwarded to the description element.
collapsible
boolean
false
When type is "single", allows closing content when clicking trigger for an open item. When type is "multiple", this prop has no effect.
dir
Direction
'ltr'
The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.
disabled
boolean
false
When `true`, prevents the user from interacting with the accordion and all its items
orientation
DataOrientation
'vertical'
The orientation of the accordion.
unmountOnHide
boolean
`true`
When `true`, the element will be unmounted on closed state.
modelValue
(M extends true ? string[] : string)
—
The controlled value of the selected item(s). Use this when you need to control the state of the items. Can be bound with `v-model`
defaultValue
(M extends true ? string[] : string)
—
The default value of the selected item(s). Use this when you need to set the initial state of the items.
multiple
M
—
Determines whether a "single" or "multiple" items can be selected at a time. This prop will overwrite the inferred type from `modelValue` and `defaultValue`.
selectionBehavior
SelectionBehavior
'toggle'
How multiple selection should behave in the collection.
Emits
Emit NameParametersDescription
update:modelValue
M extends true ? string[] : string
—
Slots
Slot NameParametersDescription
item
AccordionCompactSlotProps<T, M>
Custom content for the item slot.
leading
AccordionCompactSlotProps<T, M>
Custom content for the leading slot.
title
AccordionCompactSlotProps<T, M>
Custom content for the title slot.
trigger-icon
AccordionCompactSlotProps<T, M>
Custom content for the trigger icon slot.
content
AccordionCompactSlotProps<T, M>
Custom content for the content slot.

AccordionContent

3 Props
Props
PropTypeDefaultDescription
forceMount
boolean
—
Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

AccordionDescription

AccordionHeader

AccordionItem

5 Props
Props
PropTypeDefaultDescription
value
string
—
Value of the accordion item. All items within an accordion should use a unique value.
disabled
boolean
—
When `true`, prevents the user from interacting with the collapsible.
unmountOnHide
boolean
—
When `true`, the element will be unmounted on closed state.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

AccordionRoot<M>

9 Props1 Emits
Props
PropTypeDefaultDescription
collapsible
boolean
false
When type is "single", allows closing content when clicking trigger for an open item. When type is "multiple", this prop has no effect.
dir
Direction
'ltr'
The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.
disabled
boolean
false
When `true`, prevents the user from interacting with the accordion and all its items
orientation
DataOrientation
'vertical'
The orientation of the accordion.
unmountOnHide
boolean
`true`
When `true`, the element will be unmounted on closed state.
modelValue
(M extends true ? string[] : string)
—
The controlled value of the selected item(s). Use this when you need to control the state of the items. Can be bound with `v-model`
defaultValue
(M extends true ? string[] : string)
—
The default value of the selected item(s). Use this when you need to set the initial state of the items.
multiple
M
—
Determines whether a "single" or "multiple" items can be selected at a time. This prop will overwrite the inferred type from `modelValue` and `defaultValue`.
selectionBehavior
SelectionBehavior
'toggle'
How multiple selection should behave in the collection.
Emits
Emit NameParametersDescription
update:modelValue
M extends true ? string[] : string
—

AccordionTrigger

5 Props
Props
PropTypeDefaultDescription
disabledCollapsible
boolean
—
When `true`, prevents the user from toggling the collapsible.
type
ButtonType
'button'
The type of the button element. Can be one of 'button', 'submit', or 'reset'.
disabled
boolean
—
Whether the component is disabled.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

Notes

Architecture and benchmark differences

AccordionCompact owns the items iteration and default content assembly while every primitive stays style-free and only the UI wrapper injects the accordionVariants classes. This mirrors shadcn/ui’s headless split and Radix’s Accordion primitive, unlike Ant Design, Element Plus, Mantine and Naive UI which ship a config-driven collapse with defaultActiveKey/activeKey. Vean’s root uses useSelection so single/multiple modes share one state model, and arrow-key navigation is driven by the same useArrowNavigation composable used across the menu family for consistency.

CapabilityVeanUIshadcn/uiAnt Design CollapseElement Plus CollapseMantine AccordionNaive UI Collapse
Aria/styled split✅✅————
Single / multiple✅✅✅✅✅✅
Collapsible (all closed)✅✅✅✅✅✅
Keyboard arrow navigation✅✅✅✅✅✅
Custom trigger icon✅—✅✅✅✅
Data-driven items (Compact)✅—✅✅✅✅
Disabled item✅✅✅✅✅✅
Orientation (v/h)✅—✅✅——
as/asChild trigger✅✅————

— = unsupported or a different interaction model.

Cautions

  • In single mode (multiple: false) only one section stays open; with collapsible (default true) clicking the open trigger closes it, leaving all sections closed.
  • Arrow-key navigation requires a trigger to be focused; the keys follow orientation (ArrowUp/ArrowDown vertically, ArrowLeft/ArrowRight horizontally) and swap under RTL via dir.
  • unmountOnHide (default true) unmounts closed content; set it to false to keep it in the DOM (e.g. to preserve inner form state).
  • The default trigger chevron rotates with CSS based on data-state; replace it via the trigger-icon slot if you need a different indicator.
  • Disabled items ignore clicks and are skipped by arrow navigation but remain reachable in the DOM order for assistive tech.

Roadmap

No blocking gaps identified for the core accordion API. A bordered variant set and a left-icon trigger layout are evaluated as enhancements tracked in docs/roadmap/README.md.

FAQ

How do I allow only one section open at a time?

Single mode is the default — bind modelValue to a single value:

<SAccordion v-model="open" :items="items" />

How do I allow multiple sections open?

Set multiple and bind an array:

<SAccordion v-model="openList" multiple :items="items" />

How do I let all sections be closed?

collapsible is true by default, so clicking the open trigger closes it:

<SAccordion collapsible :items="items" />

How do I customize the trigger icon?

Use the trigger-icon slot (or leading for a left icon):

<SAccordion :items="items">
  <template #trigger-icon="{ open }">
    <SIcon :icon="open ? 'lucide:minus' : 'lucide:plus'" />
  </template>
</SAccordion>

How do I build a fully custom item?

Use the item slot to compose the Aria parts yourself:

<SAccordion :items="items">
  <template #item="{ item, open }">
    <div class="border-b">
      <button type="button" :aria-expanded="open">{{ item.title }}</button>
      <div v-if="open">{{ item.description }}</div>
    </div>
  </template>
</SAccordion>

Changelog

Version history is grouped by release so you can quickly see what changed for this component across published versions.

v0.22.0

2026-05-13

Compare release

Optimization

enable collapsible behavior by default and update related props

Scope: accordionAuthors: soybeanjsView commitbec18

v0.15.0

2026-04-26

Compare release

Feature

Implement AccordionCompact component and update related types and context

Scope: accordionAuthors: soybeanjsView commite05b3

Feature

add AccordionDescription component and update related files

Scope: accordionAuthors: soybeanfeView commit6506e

Optimization

optimize slot template types

Scope: accordionAuthors: soybeanjsView commitdb7a1

Optimization

reorganize imports and update slot structure for Accordion components

Scope: accordionAuthors: soybean-jsView commit22707

Feature

add AccordionDescription component and update related files

Scope: accordionAuthors: soybeanfeView commit6506e

Optimization

reorganize imports and update slot structure for Accordion components

Scope: accordionAuthors: soybean-jsView commit22707

Feature

Implement AccordionCompact component and update related types and context

Scope: accordionAuthors: soybeanjsView commite05b3

Optimization

optimize slot template types

Scope: accordionAuthors: soybeanjsView commitdb7a1

v0.8.0

2026-02-10

Compare release

Fix

add default value for unmountOnHide prop

Scope: accordionAuthors: soybeanjsView commit1f86b

v0.0.2

2025-11-18

Compare release

Feature

implement accordion component structure with root, item, header, content, trigger, and context management

Scope: accordionAuthors: soybeanjsView commit183c5

Feature

add theme context for customizable styles across accordion components

Scope: accordionAuthors: soybeanjsView commite7600

Feature

implement Accordion component with props management, customizable slots, and theme context integration

Scope: accordionAuthors: soybeanjsView commita0fcd

Feature

add multiple accordion examples with custom icons and styling options, and integrate Card component examples

Scope: accordionAuthors: soybeanjsView commitc6128

Feature

implement Accordion component with customizable slots and props, enhancing accordion functionality and theming support

Scope: accordionAuthors: soybeanjsView commitbe778

Fix

enhance content slot by wrapping description in a paragraph and update accordion variant styles for better spacing

Scope: accordionAuthors: soybeanjsView commit7a4cc

Fix

adjust padding and gap values for trigger elements across all size variants for improved layout consistency

Scope: accordionAuthors: soybeanjsView commitdb0e7

Optimization

optimize accordion with useSelection

Scope: accordionAuthors: soybeanjsView commit220ac

Refactor

rename root element reference for clarity and update trigger ID prefix for uniqueness

Scope: accordionAuthors: soybeanjsView commit19086

Refactor

replace direct collection item attribute usage with utility function to improve keydown handling

Scope: accordionAuthors: soybeanjsView commit5e894

Refactor

update accordion context to use shallowRef for rootElement and improve direction handling

Scope: accordionAuthors: soybeanjsView commit273cc

Refactor

simplify accordion component props by removing unnecessary type parameters and improving clarity in single/multiple handling

Scope: accordionAuthors: soybeanjsView commit5d201

Refactor

rename toggleModelValue to onModelValueChange for improved clarity in value handling

Scope: accordionAuthors: soybeanjsView commitf3161

Refactor

rename 'direction' to 'dir' for consistency in context handling

Scope: accordionAuthors: soybeanjsView commit99efc

Refactor

rename type AccordionItemData to AccordionOptionData

Scope: accordionAuthors: soybeanjsView commit13ef9

Feature

implement accordion component structure with root, item, header, content, trigger, and context management

Scope: accordionAuthors: soybeanjsView commit183c5

Feature

add theme context for customizable styles across accordion components

Scope: accordionAuthors: soybeanjsView commite7600

Feature

implement Accordion component with props management, customizable slots, and theme context integration

Scope: accordionAuthors: soybeanjsView commita0fcd

Feature

add multiple accordion examples with custom icons and styling options, and integrate Card component examples

Scope: accordionAuthors: soybeanjsView commitc6128

Feature

implement Accordion component with customizable slots and props, enhancing accordion functionality and theming support

Scope: accordionAuthors: soybeanjsView commitbe778

Fix

enhance content slot by wrapping description in a paragraph and update accordion variant styles for better spacing

Scope: accordionAuthors: soybeanjsView commit7a4cc

Fix

adjust padding and gap values for trigger elements across all size variants for improved layout consistency

Scope: accordionAuthors: soybeanjsView commitdb0e7

Optimization

optimize accordion with useSelection

Scope: accordionAuthors: soybeanjsView commit220ac

Refactor

rename root element reference for clarity and update trigger ID prefix for uniqueness

Scope: accordionAuthors: soybeanjsView commit19086

Refactor

replace direct collection item attribute usage with utility function to improve keydown handling

Scope: accordionAuthors: soybeanjsView commit5e894

Refactor

update accordion context to use shallowRef for rootElement and improve direction handling

Scope: accordionAuthors: soybeanjsView commit273cc

Refactor

simplify accordion component props by removing unnecessary type parameters and improving clarity in single/multiple handling

Scope: accordionAuthors: soybeanjsView commit5d201

Refactor

rename toggleModelValue to onModelValueChange for improved clarity in value handling

Scope: accordionAuthors: soybeanjsView commitf3161

Refactor

rename 'direction' to 'dir' for consistency in context handling

Scope: accordionAuthors: soybeanjsView commit99efc

Refactor

rename type AccordionItemData to AccordionOptionData

Scope: accordionAuthors: soybeanjsView commit13ef9