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
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | string | string[] | — | Open item value(s). Bind with v-model. |
type | 'single' | 'multiple' | 'single' | One open item, or several. |
collapsible | boolean | true | When single, allow closing the open item. |
disabled | boolean | false | Disables every item. |
AccordionItem props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Identifies the item within the accordion. |
title | string | — | Header text. Falls back to the title slot. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Heading level for the trigger, so the accordion fits the page outline. |
Set
headingLevelto match your page's heading structure. reka's default ish3, which trips theheading-orderrule when an accordion sits directly under anh1with no interveningh2.
Slots
| Slot | Where | Description |
|---|---|---|
default | Accordion | The AccordionItems. |
title | AccordionItem | Replaces the header text. |
default | AccordionItem | The collapsible panel body. |
Accessibility
- reka-ui renders each header as a
buttonwitharia-expandedandaria-controls, wired to a panel withrole="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 withtext-startand logical spacing, so it mirrors correctly underdir="rtl".
