GhostAccordion
GhostAccordion coordinates multiple in-flow disclosure panels following the WAI-ARIA APG Accordion pattern. Each panel reuses GhostCollapsible for open state and semantics. Import it from @ghostvue/themes for default styling, as every example on the ordinary path below does. For unstyled use from @ghostvue/vue, see Advanced: headless composition.
Release policy
Multiple-expansion release policy accordion with expand/collapse actions and responsive header.
Multiple-expansion mode coordinates a controlled string[] of open section values alongside external expand/collapse actions. The header adapts to the preview width with @container ghost-demo.
One answer at a time
Single collapsible expansion with a decorative plus/minus indicator that follows aria-expanded.
type="single" with collapsible keeps at most one answer open and lets the reader close the open one again. Focus a question and press ArrowDown, ArrowUp, Home, or End to move between headers, then Enter or Space to expand it. Opening a second question closes the first, and each trigger's aria-expanded follows. Every header stays in the tab sequence; the arrow keys only move focus.
The plus/minus is consumer markup inside the trigger. It is decorative and carries aria-hidden="true" because the trigger already exposes its state through aria-expanded. Its CSS reads that attribute, so the visible indicator and the announced state cannot drift apart.
Multiple expansion
Multiple expansion with default surface styles.
type="multiple" tracks a string[] of open item values. Themed examples load default.css and reuse collapsible trigger and panel surfaces. The themed root and items add data-themed, so loading the stylesheet does not restyle headless accordions on the same page.
Accessibility
- Disclosure triggers sit in programmatic headings with
aria-expandedandaria-controls. - Arrow keys, Home, and End optionally move focus among direct triggers (no roving
tabindex). - Non-collapsible single mode sets
aria-disabled="true"on the open trigger. - Root and item
disabledprevent toggling.
Advanced: headless composition
Use this section when your team brings its own design system. Import the same parts from @ghostvue/vue; they keep the behavior and ARIA wiring and render no visual treatment.
Basic use
Single expansion with collapsible coordination over panels.
The unstyled accordion has the same single-expansion contract as the billing questions above. You own the trigger, panel, focus ring, and any indicator styling.
API
See the generated component references for props, emits, slots, exposed members, styling hooks, and executable examples.
| Prop | Type | Default | Description |
|---|---|---|---|
collapsible | boolean | false | When type is single, allow closing the active panel. |
defaultValue | GhostAccordionValue | — | Initial expansion when modelValue is omitted. |
disabled | boolean | false | Disables toggling on every item when true. |
headingLevel | GhostAccordionHeadingLevel | 3 | Heading level wrapping each accordion trigger (h1–h6). |
modelValue | GhostAccordionValue | — | Controlled expansion value. Omit for uncontrolled mode. |
type | GhostAccordionType | "single" | Single or multiple expanded panels. |
| Slot | Slot props | Description |
|---|---|---|
default | — | Accordion items. |
@ghostvue/themes adds no props, events, or slots to the headless GhostAccordion API, which it forwards.
GhostAccordion (root)
Emits update:modelValue with string | string[] | undefined depending on type. Delegates optional arrow-key navigation among direct item triggers.
GhostAccordionItem
Wraps GhostCollapsible with controlled :open from the root modelValue.
GhostAccordionTrigger
Renders a heading (h1–h6 via root headingLevel) around GhostCollapsibleTrigger.
GhostAccordionContent
Proxies GhostCollapsibleContent with the same hidden and aria-labelledby behavior.