Skip to content

Accordion ​

Accordion and AccordionItem show collapsible sections, built on reka-ui. Put AccordionItems inside Accordion and bind v-model to the open item's value (or an array of values with type="multiple").

vue
<script setup lang="ts">
import { ref } from 'vue'
import { Accordion, AccordionItem } from '@myghf/ui'

const open = ref('clinical')
</script>

<template>
  <Accordion v-model="open">
    <AccordionItem value="clinical" title="Clinical notes">…</AccordionItem>
    <AccordionItem value="labs" title="Lab results">…</AccordionItem>
  </Accordion>
</template>

Progress notes for the admission.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { Accordion, AccordionItem } from '@myghf/ui'

const open = ref('clinical')
</script>

<template>
  <Accordion v-model="open" class="max-w-md">
    <AccordionItem value="clinical" title="Clinical notes">
      Progress notes for the admission.
    </AccordionItem>
    <AccordionItem value="labs" title="Lab results">
      Latest bloods and imaging.
    </AccordionItem>
  </Accordion>
</template>

Accordion props ​

PropTypeDefaultDescription
modelValuestring | string[]—Open item value(s). Bind with v-model.
type'single' | 'multiple''single'One open item, or several.
collapsiblebooleantrueWhen single, allow closing the open item.
disabledbooleanfalseDisables every item.

AccordionItem props ​

PropTypeDefaultDescription
valuestring—Identifies the item within the accordion.
titlestring—Header text. Falls back to the title slot.
headingLevel2 | 3 | 4 | 5 | 63Heading level for the trigger, so the accordion fits the page outline.

Set headingLevel to match your page's heading structure. reka's default is h3, which trips the heading-order rule when an accordion sits directly under an h1 with no intervening h2.

Slots ​

SlotWhereDescription
defaultAccordionThe AccordionItems.
titleAccordionItemReplaces the header text.
defaultAccordionItemThe collapsible panel body.

Accessibility ​

  • reka-ui renders each header as a button with aria-expanded and aria-controls, wired to a panel with role="region"; Enter/Space toggle it, and the chevron is decorative (aria-hidden).

Dark mode & RTL ​

  • The frame uses semantic tokens (border-border, bg-surface, text-muted), so it adapts to dark mode automatically. The header is a flex row with text-start and logical spacing, so it mirrors correctly under dir="rtl".

Released under the MIT License.