Skip to content

Accordion ​

Terminal-style collapsible panel with support for multiple sections and custom slots.

Accordion

Design lines ​

▶Network
▶Display
▶Sound
▶Privacy
▶Updates
vue
1<Tabs defaultValue="tuix">2  <TabsList>3    <Tab value="tuix">TUIX</Tab>4    <Tab value="rubik">Rubik</Tab>5  </TabsList>6  <TabPanel value="tuix">7    <Accordion :items="items" design="tuix" />8  </TabPanel>9  <TabPanel value="rubik">10    <Accordion :items="items" design="rubik" />11  </TabPanel>12</Tabs>

Demo ​

Opening state ​

How many panels can be open at once: single, multiple, or controlled by the parent.

Simple (default) ​

Un solo panel abierto a la vez. Al abrir otro, el anterior se cierra.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Accordion } from '@dowardev/herdrate-vue'45const items = [6  { title: 'Network', content: 'Configure Wi-Fi, Ethernet, VPN, and proxy settings.' },7  { title: 'Display', content: 'Adjust resolution, scaling, color profile, and night mode.' },8  { title: 'Sound', content: 'Manage input/output devices, volume levels, and alerts.' },9  { title: 'Privacy', content: 'Control app permissions, analytics, and location services.' },10  { title: 'Updates', content: 'Configure automatic updates, beta channel, and restart behavior.' },11]1213const opened = ref<number[]>([])14</script>1516<template>17  <Accordion :items="items" @update:opened="opened = $event" />18  <p v-if="opened.length" style="color:var(--text-muted);font-size:0.8rem;">Opened: {{ opened }}</p>19</template>

Multiple (multiple) ​

Permite tener varios paneles abiertos simultáneamente.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Accordion } from '@dowardev/herdrate-vue'45const items = [6  { title: 'Network', content: 'Configure Wi-Fi, Ethernet, VPN, and proxy settings.' },7  { title: 'Display', content: 'Adjust resolution, scaling, color profile, and night mode.' },8  { title: 'Sound', content: 'Manage input/output devices, volume levels, and alerts.' },9  { title: 'Privacy', content: 'Control app permissions, analytics, and location services.' },10  { title: 'Updates', content: 'Configure automatic updates, beta channel, and restart behavior.' },11]1213const multiOpened = ref<number[]>([0, 2])14</script>1516<template>17  <Accordion :items="items" multiple @update:opened="multiOpened = $event" />18  <p v-if="multiOpened.length" style="color:var(--text-muted);font-size:0.8rem;">Opened: {{ multiOpened }}</p>19</template>

Controlled (opened / update:opened) ​

Binds the open panels to parent state with :opened and update:opened. The buttons really drive the accordion.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Accordion, Button } from '@dowardev/herdrate-vue'45const items = [ ... ]6const controlledOpened = ref<number[]>([2])7</script>89<template>10  <div style="display:flex;gap:0.5rem;margin-bottom:0.5rem;">11    <Button @click="controlledOpened = []">Close all</Button>1213    <Button @click="controlledOpened = [0, 1, 2, 3, 4]">Open all</Button>1415    <Button @click="controlledOpened = [2]">Sound only</Button>16  </div>1718  <Accordion :items="items" multiple :opened="controlledOpened" @update:opened="controlledOpened = $event" />19</template>

Indicator color (color) ​

Changes the color of the ▶/▼ marker. Panels start open (default-opened) so the color is visible on both design lines.

vue
1<Accordion :items="[{ title: 'Primary', content: 'Color primary' }]" color="primary" :default-opened="[0]" />2<Accordion :items="[{ title: 'Success', content: 'Color success' }]" color="success" :default-opened="[0]" />3<Accordion :items="[{ title: 'Danger', content: 'Color danger' }]" color="danger" :default-opened="[0]" />4<Accordion :items="[{ title: 'Warning', content: 'Color warning' }]" color="warning" :default-opened="[0]" />

Rich content (item-content slot) ​

Usa el slot item-content para contenido HTML/Vue en lugar de content string.

vue
1<Accordion :items="[{ title: 'Con lista' }, { title: 'Con código' }]">2  <template #item-content="{ index }">3    <div v-if="index === 0">4      <ul><li>Item A</li><li>Item B</li><li>Item C</li></ul>5    </div>6    <div v-else><code>const x = 1</code></div>7  </template>8</Accordion>

Props ​

items ​

Array of accordion panels.

TypeDefaultRequired
Array<{title: string, content?: string}>[]❌

Each item has this shape:

FieldTypeRequiredDescription
titlestring✅Panel title
contentstring❌Panel content

multiple ​

Allows opening several panels simultaneously. Defaults to single-open mode, which enforces at most one open panel: interaction and defaultOpened both keep only the most recent index.

TypeDefaultRequired
booleanfalse❌

opened ​

Indices of the open panels, managed by your code. Bind it with v-model:opened or :opened + @update:opened (see the "Opening state" demo). While this prop is passed, the component does not keep its own state — on click it emits update:opened and only opens the panel when the parent updates the prop. It takes precedence over defaultOpened. To have the parent enforce a single open panel, pass a one-element list.

TypeDefaultRequired
number[]undefined❌

defaultOpened ​

Panel indices open on first render (uncontrolled mode). Initial-only: later changes are ignored. In single mode only the last index is kept.

TypeDefaultRequired
number[][]❌

color ​

Color of the opening indicator (▶/▼). Applies to both design lines.

TypeDefaultRequired
'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark''primary'❌

design ​

Design line (or inherit from data-design).

TypeDefaultRequired
'tuix' | 'rubik'— (inherits from data-design)❌

Events ​

EventPayloadDescription
update:openedindices: number[]Emitted when the open panels change

Slots ​

SlotPropsDescription
item-title{ index: number, open: boolean }Custom header content (replaces indicator + title)
item-content{ index: number, open: boolean }Custom panel body (replaces the content string)

CSS Custom Properties ​

TokenDefaultDescription
--font-mono"JetBrains Mono", ui-monospace, monospaceMonospace font stack for code-like content (key labels, log lines, chips).
--accentfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Accent color, mapped from the active semantic color.
--bgfrom theme (--ctp-latte-base / --ctp-mocha-base)Base background of the surface.
--bg-altfrom theme (--ctp-latte-mantle / --ctp-mocha-mantle)Alternate background (the next layer down from the base).
--bg-elevatedfrom theme (--ctp-latte-surface0 / --ctp-mocha-surface0)Background of floating surfaces (modals, dropdowns, popovers).
--bg-panelfrom theme (--ctp-latte-surface1 / --ctp-mocha-surface1)Background of panel-like raised surfaces (cards, accordions).
--borderfrom theme (--ctp-latte-surface0 / --ctp-mocha-surface0)Outline and divider color for surfaces.
--textfrom theme (--ctp-latte-text / --ctp-mocha-text)Primary text color used inside the component.
--text-mutedfrom theme (--ctp-latte-subtext1 / --ctp-mocha-subtext1)Secondary text for hints, annotations and disabled state.
--color-primaryfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Primary semantic color (mauve in Catppuccin).
--color-secondaryfrom theme (--ctp-latte-lavender / --ctp-mocha-lavender)Secondary semantic color (lavender in Catppuccin).
--color-tertiaryfrom theme (--ctp-latte-blue / --ctp-mocha-blue)Tertiary semantic color (blue in Catppuccin).
--color-successfrom theme (--ctp-latte-green / --ctp-mocha-green)Success semantic color (green in Catppuccin).
--color-warningfrom theme (--ctp-latte-yellow / --ctp-mocha-yellow)Warning semantic color (yellow in Catppuccin).
--color-dangerfrom theme (--ctp-latte-red / --ctp-mocha-red)Danger semantic color (red in Catppuccin).
--color-lightfrom theme (--ctp-latte-surface1 / --ctp-mocha-rosewater)Light semantic color (lighter contrast tone).
--color-mediumfrom theme (--ctp-latte-overlay0 / --ctp-mocha-overlay2)Medium semantic color (mid-tone).
--color-darkfrom theme (--ctp-latte-text / --ctp-mocha-subtext1)Dark semantic color (high contrast text).
--accordion-indicatorvar(--text-muted) when closed, var(--color-primary) when openColor of the ▶/▼ open-state chevron in accordion items.

Ver Theming para la convención completa.