Display

Accordion

A stack of disclosures that coordinate: in `single` mode, opening one closes the rest. Built from `JAccordion` and `JAccordionItem`.

Orders ship within one business day. Tracking is emailed as soon as the label is created.

Returns are accepted within 30 days of delivery, in original condition.

Every product carries a two-year warranty against manufacturing defects.

Installation #

With the Nuxt module, every component is auto-imported — there is nothing to add. In a plain Vue project, import what you use:

Copy
import { JAccordion, JAccordionItem } from '@juxtui/ui'

Usage #

Copy
<JAccordion v-model="open">
  <JAccordionItem value="shipping" title="Shipping">
    Orders ship within one business day.
  </JAccordionItem>
  <JAccordionItem value="returns" title="Returns">
    Returns are accepted within 30 days of delivery.
  </JAccordionItem>
</JAccordion>

In single mode (the default), opening an item closes any other — set type="multiple" and the model becomes an array to allow several open at once.

Each trigger renders inside a heading element (h3 by default) so the accordion contributes a correct outline — change it with heading-level.

Variants & examples #

Multiple open#

type="multiple", several panels open at once.

Orders ship within one business day.

Returns are accepted within 30 days of delivery.

Every product carries a two-year warranty.

Disabled item#

Orders ship within one business day.

Returns are accepted within 30 days of delivery.

Every product carries a two-year warranty.

API #

JAccordion

PropTypeDefault Description
modelValuestring | string[] | nullnullBound with v-model. A single value in single mode, an array in multiple mode.
type'single' | 'multiple''single'single keeps at most one item open; multiple lets any number stay open.
collapsiblebooleantrueIn single mode, allow closing the open item so none are open.
headingLevel2 | 3 | 4 | 5 | 63Heading level wrapping each trigger, for a correct document outline.

Events

EventPayload Description
update:modelValuestring | string[] | nullEmitted when an item is opened or closed.

Slots

SlotProps Description
default—The JAccordionItems.

JAccordionItem

PropTypeDefault Description
valuestring—Identifies the item in the accordion’s v-model. Required.
titlestring—Trigger label. The title slot overrides it.
disabledbooleanfalseSkipped by keyboard navigation and not selectable.

Slots

SlotProps Description
default—Panel content.
title—Custom trigger content.

Accessibility #

  • Follows the WAI-ARIA accordion pattern: triggers are native buttons with aria-expanded and aria-controls, arranged for arrow-key navigation.
  • Each panel is role="region", labelled by its trigger, and marked inert while closed.
  • Panel height animates through CSS grid rows and is skipped under reduced motion.

Keyboard #

Key Action
↓↑Move between triggers, wrapping around.
HomeEndJump to the first or last trigger.
EnterToggles the focused item.
SpaceToggles the focused item.