<script setup>
import { Accordion } from "@dicehub/kappa/components/accordion";
const sections = [
{
value: "mesh",
title: "Mesh",
detail: "2.4 million cells across 24 partitions. Quality checks passed.",
},
{
value: "solver",
title: "Solver",
detail: "The PIMPLE solver runs six correctors with an adaptive time step.",
},
{
value: "results",
title: "Results",
detail: "Pressure, velocity, and force histories are available for review.",
},
];
</script>
<template>
<Accordion.Root :default-value="['mesh']">
<Accordion.Item v-for="section in sections" :key="section.value" :value="section.value">
<Accordion.Trigger>
{{ section.title }}
</Accordion.Trigger>
<Accordion.Content>{{ section.detail }}</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</template>Installation
Barrel
import {
Accordion,
AccordionRoot,
AccordionItem,
AccordionTrigger,
AccordionContent,
AccordionIndicator,
} from "@dicehub/kappa";Granular
import {
Accordion,
AccordionRoot,
AccordionItem,
AccordionTrigger,
AccordionContent,
AccordionIndicator,
} from "@dicehub/kappa/components/accordion";Usage
Give every item a stable value. A single accordion keeps one section open by default; add collapsible when an all-closed state is useful.
<script setup>
import { Accordion } from "@dicehub/kappa/components/accordion";
</script>
<template>
<Accordion.Root :default-value="['setup']">
<Accordion.Item value="setup">
<Accordion.Trigger>
Case setup
</Accordion.Trigger>
<Accordion.Content>
Select the mesh, solver, and boundary conditions for this run. The section can contain
links, settings, tables, or any other Vue content.
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</template>Composition
Accordion.Root
├── Accordion.Item
│ ├── Accordion.Trigger
│ │ └── Accordion.Indicator
│ └── Accordion.Content
└── Accordion.Item
├── Accordion.Trigger
└── Accordion.ContentUse the compound API for concise templates or named exports when explicit imports improve discoverability. Trigger supplies the default indicator; its indicator slot accepts a custom AccordionIndicator composition.
<script setup>
import {
AccordionRoot,
AccordionItem,
AccordionTrigger,
AccordionContent,
AccordionIndicator,
} from "@dicehub/kappa/components/accordion";
</script>
<template>
<AccordionRoot :default-value="['mesh']">
<AccordionItem value="mesh">
<AccordionTrigger>
Mesh quality
<template #indicator><AccordionIndicator /></template>
</AccordionTrigger>
<AccordionContent>
Maximum non-orthogonality is 48.2° and maximum skewness is 1.84. Both values remain
inside the accepted quality limits.
</AccordionContent>
</AccordionItem>
</AccordionRoot>
</template>Examples
Basic
Single mode closes the previous item when another one opens.
<script setup>
import { Accordion } from "@dicehub/kappa/components/accordion";
</script>
<template>
<Accordion.Root :default-value="['geometry']">
<Accordion.Item value="geometry">
<Accordion.Trigger>Geometry</Accordion.Trigger>
<Accordion.Content>
The geometry contains 12 watertight regions. Surface checks found no open edges or
self-intersections.
</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="mesh">
<Accordion.Trigger>Mesh</Accordion.Trigger>
<Accordion.Content>
The volume mesh contains 2.4 million cells across 24 partitions. All quality checks
passed before decomposition.
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</template>Multiple
Combine multiple and collapsible for independently reviewable sections.
<script setup>
import { Accordion } from "@dicehub/kappa/components/accordion";
</script>
<template>
<Accordion.Root :default-value="['mesh', 'boundaries']" multiple collapsible>
<Accordion.Item value="mesh">
<Accordion.Trigger>Mesh summary</Accordion.Trigger>
<Accordion.Content>
The mesh contains 2.4 million cells across 24 balanced partitions. The largest load
imbalance is 1.7%.
</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="boundaries">
<Accordion.Trigger>Boundary summary</Accordion.Trigger>
<Accordion.Content>
Seven boundary patches are ready for review. Inlet, outlet, and wall conditions are
assigned to every face.
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</template>Disabled
Disable one item when its data is unavailable. Arrow-key navigation skips its trigger.
<script setup>
import { Accordion } from "@dicehub/kappa/components/accordion";
</script>
<template>
<Accordion.Root :default-value="['mesh']">
<Accordion.Item value="mesh">
<Accordion.Trigger>Mesh</Accordion.Trigger>
<Accordion.Content>
Mesh diagnostics are available. Review cell quality, patch coverage, and partition
balance before starting the run.
</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="decomposition" disabled>
<Accordion.Trigger>Domain decomposition</Accordion.Trigger>
<Accordion.Content>
Decomposition is unavailable while meshing. It becomes available after the mesh passes
its final quality check.
</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="solver">
<Accordion.Trigger>Solver</Accordion.Trigger>
<Accordion.Content>
Solver controls are ready. The selected tolerances and relaxation factors have been
validated for this case.
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</template>Controlled
Use v-model when another part of the application needs the expanded values.
<script setup>
import { ref } from "vue";
import { Accordion } from "@dicehub/kappa/components/accordion";
const openPanels = ref(["residuals"]);
</script>
<template>
<Accordion.Root v-model="openPanels" collapsible>
<Accordion.Item value="residuals">
<Accordion.Trigger>Residuals</Accordion.Trigger>
<Accordion.Content>
All normalized residuals are below 1e-5. Pressure has fallen by more than four orders
of magnitude since the first iteration.
</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="forces">
<Accordion.Trigger>Forces</Accordion.Trigger>
<Accordion.Content>
The mean drag coefficient is 0.31 over the latest sampling window. Oscillation remains
below 0.6%.
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
<p>Open panels: {{ openPanels.join(", ") || "none" }}</p>
</template>Right-to-left
Set dir="rtl" on the root so logical spacing and horizontal keyboard navigation follow the interface direction.
<script setup>
import { Accordion } from "@dicehub/kappa/components/accordion";
</script>
<template>
<div dir="rtl">
<Accordion.Root dir="rtl" :default-value="['results']" collapsible>
<Accordion.Item value="results">
<Accordion.Trigger>نتائج المحاكاة</Accordion.Trigger>
<Accordion.Content>
الضغط والسرعة جاهزان للمراجعة. اكتملت آخر عملية كتابة عند ٢٫٤ ثانية.
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</div>
</template>Lazy Mount
Combine lazyMount and unmountOnExit for expensive plots or editors that should exist only while their section is expanded.
<script setup>
import { Accordion } from "@dicehub/kappa/components/accordion";
</script>
<template>
<Accordion.Root lazy-mount unmount-on-exit collapsible>
<Accordion.Item value="plots">
<Accordion.Trigger>Residual plots</Accordion.Trigger>
<Accordion.Content>
Residual plots mount only while this item is open. Closing the section removes the chart
from the document and releases its observers.
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</template>Accessibility
- Triggers are native buttons with managed
aria-expandedandaria-controls. - Enter and Space toggle the focused item. Tab leaves accordion focus in normal document order.
- Arrow keys move between enabled triggers; Home and End move to the first and last trigger.
- Disabled items are unavailable and skipped during directional keyboard navigation.
- When trigger labels introduce page regions, wrap them in headings at the correct document level.
- Keep trigger labels concise and descriptive without relying on the indicator or position.
- Expansion and indicator motion honor
prefers-reduced-motion.
Kappa preserves Ark UI behavior. See theofficial Ark UI Accordion documentationfor the primitive contract and keyboard support.
API Reference
Accordion.Root
Forwards remaining attributes and listeners to Ark UI's root element.
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | string[] | - | Controlled list of expanded item values; supports v-model. |
defaultValue | string[] | [] | Initially expanded values for uncontrolled use. |
collapsible | boolean | false | Allows the last expanded item to close. |
multiple | boolean | false | Allows more than one item to remain expanded. |
disabled | boolean | false | Disables every item in the accordion. |
dir | "ltr" | "rtl" | inherited | Sets logical direction and horizontal keyboard navigation. |
orientation | "vertical" | "horizontal" | "vertical" | Sets layout and directional keyboard behavior. |
lazyMount | boolean | false | Defers panel mounting until its first expansion. |
unmountOnExit | boolean | false | Removes panel content after its close transition. |
id | string | generated | Stable identifier for the accordion state machine. |
ids | AccordionRootProps['ids'] | generated | Overrides generated root, item, trigger, and content IDs. |
asChild | boolean | false | Merges root behavior into the single child element. |
Accordion.Item
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | required | Stable value identifying the item. |
disabled | boolean | false | Disables this item and removes it from arrow-key navigation. |
asChild | boolean | false | Merges item behavior into the single child element. |
Parts
| Part | Element | Description |
|---|---|---|
Accordion.Trigger | button | Toggles its item and manages focus and ARIA relationships. |
Accordion.Content | div | Animated region associated with its trigger. |
Accordion.Indicator | div | Decorative state indicator that follows the item state. |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | string[] | Emitted whenever the controlled expanded values change. |
valueChange | { value: string[] } | Ark UI detail emitted after an item opens or closes. |
focusChange | { value: string | null } | Ark UI detail emitted when trigger focus changes. |
Exports
| Export | Description |
|---|---|
Accordion | Compound API exposing Root, Item, Trigger, Content, and Indicator. |
AccordionRoot | Unaugmented root component. |
AccordionItem | Item state and value boundary. |
AccordionTrigger | Keyboard-operable item trigger. |
AccordionContent | Animated item content region. |
AccordionIndicator | Decorative disclosure indicator. |
AccordionRootProps | Public root props and Ark UI state contract. |
AccordionItemProps | Public item props. |
AccordionEmits | Root event contract. |
AccordionSlots | Root slot contract. |
AccordionItemSlots | Item slot contract. |
AccordionTriggerSlots | Trigger default and indicator slot contract. |
AccordionContentSlots | Content slot contract. |
AccordionIndicatorSlots | Indicator slot contract. |
AccordionDirection | Supported logical direction union. |
AccordionOrientation | Supported orientation union. |
AccordionValueChangeDetails | Payload for valueChange. |
AccordionFocusChangeDetails | Payload for focusChange. |