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:
import { JAccordion, JAccordionItem } from '@juxtui/ui'Usage #
<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
| Prop | Type | Default | Description |
|---|---|---|---|
| modelValue | string | string[] | null | null | Bound 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. |
| collapsible | boolean | true | In single mode, allow closing the open item so none are open. |
| headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Heading level wrapping each trigger, for a correct document outline. |
Events
| Event | Payload | Description |
|---|---|---|
| update:modelValue | string | string[] | null | Emitted when an item is opened or closed. |
Slots
| Slot | Props | Description |
|---|---|---|
| default | — | The JAccordionItems. |
JAccordionItem
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Identifies the item in the accordion’s v-model. Required. |
| title | string | — | Trigger label. The title slot overrides it. |
| disabled | boolean | false | Skipped by keyboard navigation and not selectable. |
Slots
| Slot | Props | Description |
|---|---|---|
| default | — | Panel content. |
| title | — | Custom trigger content. |
Accessibility #
- Follows the WAI-ARIA accordion pattern: triggers are native buttons with
aria-expandedandaria-controls, arranged for arrow-key navigation. - Each panel is
role="region", labelled by its trigger, and markedinertwhile closed. - Panel height animates through CSS grid rows and is skipped under reduced motion.
Keyboard #
| Key | Action |
|---|---|
| ↓↑ | Move between triggers, wrapping around. |
| HomeEnd | Jump to the first or last trigger. |
| Enter | Toggles the focused item. |
| Space | Toggles the focused item. |