Skip to content

Expansion panels

Composable accordion / disclosure UI: GkExpansionPanels owns v-model (open panel keys), GkExpansionPanel registers a value and provides context to GkExpansionPanelTitle (header button) and GkExpansionPanelText (collapsible body). GK_EXPANSION_PANELS and GK_EXPANSION_PANEL are exported from god-kit/vue for advanced composition.

This is intentionally smaller than Vuetify’s expansion stack: no VDefaultsProvider, elevation/rounded prop matrices, or group item registry beyond value matching.

When to use

Use for grouped content where users reveal one or more sections on demand, especially for dense settings or FAQ-style layouts.

Live demo

Accordion (single open)

Multiple open

GkExpansionPanels

Props

PropTypeDefaultDescription
modelValue(string | number)[][]Keys of expanded panels; use v-model
multiplebooleanfalseWhen false, at most one panel is open (accordion)
disabledbooleanfalseDisables toggling for all panels

Slots

SlotDescription
defaultGkExpansionPanel children

GkExpansionPanel

Props

PropTypeDefaultDescription
valuestring | numberautoStable key for v-model; defaults to an internal id when omitted (standalone panel)
disabledbooleanfalseDisables this panel’s toggle

Slots

SlotDescription
defaultTypically GkExpansionPanelTitle + GkExpansionPanelText and any custom nodes

GkExpansionPanelTitle

Header control: button, aria-expanded, aria-controls, focus ring. Must be a descendant of GkExpansionPanel.

Slots

SlotDescription
defaultVisible title

GkExpansionPanelText

Collapsible region: role="region", aria-labelledby, hidden when collapsed. Must be a descendant of GkExpansionPanel.

Slots

SlotDescription
defaultPanel body

Examples

Basic

vue
<script setup lang="ts">
import { ref } from 'vue'
import {
  GkExpansionPanel,
  GkExpansionPanels,
  GkExpansionPanelText,
  GkExpansionPanelTitle,
} from 'god-kit/vue'

const open = ref<(string | number)[]>([])
</script>

<template>
  <GkExpansionPanels v-model="open" multiple>
    <GkExpansionPanel value="shipping">
      <GkExpansionPanelTitle>Shipping</GkExpansionPanelTitle>
      <GkExpansionPanelText>Details…</GkExpansionPanelText>
    </GkExpansionPanel>
    <GkExpansionPanel value="billing">
      <GkExpansionPanelTitle>Billing</GkExpansionPanelTitle>
      <GkExpansionPanelText>Details…</GkExpansionPanelText>
    </GkExpansionPanel>
  </GkExpansionPanels>
</template>

Advanced

vue
<GkExpansionPanels v-model="open" multiple>
  <!-- several independent expandable sections -->
</GkExpansionPanels>

Edge case

vue
<GkExpansionPanels :model-value="['advanced']" disabled>
  <!-- read-only review state -->
</GkExpansionPanels>

Accessibility notes

  • GkExpansionPanelTitle renders button semantics; do not replace with non-focusable custom elements.
  • Keep heading text concise so screen reader users can scan sections quickly.

Out of scope (v1)

Nested expansion groups, lazy mount of body content, and parity with Vuetify’s before-active / after-active edge styling.

Released under the MIT License.