Skip to content

OrigamExpansionPanels ​

<OrigamExpansionPanels> is the accordion container. It owns the selection state every <OrigamExpansionPanel> registers into (useGroup under ORIGAM_EXPANSION_PANEL_KEY), and it is required: a panel rendered outside one throws [Origam] Could not find useGroup injection with symbol … at runtime.

Basic usage ​

vue
<template>
    <origam-expansion-panels>
        <origam-expansion-panel title="Panel one" content="First body."/>
        <origam-expansion-panel title="Panel two" content="Second body."/>
    </origam-expansion-panels>
</template>

Data-driven ​

items renders one <origam-expansion-panel> per entry, each spread with its own props.

vue
<script setup lang="ts">
    const items = [
        { title: 'Shipping', content: 'Delivered in 2 days.' },
        { title: 'Returns',  content: '30 days, no questions.' }
    ]
</script>

<template>
    <origam-expansion-panels :items="items"/>
</template>

Selection ​

modelValue is the group's selection. With multiple it is an array of values, otherwise a single value. mandatory keeps at least one panel open (and opens the first non-disabled one when nothing is selected); max caps how many can be open at once.

vue
<template>
    <origam-expansion-panels v-model="open" multiple :max="2">
        <origam-expansion-panel value="a" title="A" content="…"/>
        <origam-expansion-panel value="b" title="B" content="…"/>
        <origam-expansion-panel value="c" title="C" content="…"/>
    </origam-expansion-panels>
</template>

Props ​

Group / selection ​

PropTypeDefaultDescription
modelValueanyundefinedSelected panel value(s). An array when multiple, a single value otherwise.
multiplebooleanundefinedAllow several panels open at once.
mandatorybooleanundefinedKeep at least one panel open; selects the first non-disabled item when nothing is selected, and refuses to deselect the last one.
maxnumberundefinedMaximum number of simultaneously open panels (multiple only).
disabledbooleanundefinedDisable every panel in the group.
selectedClassstringundefinedClass applied to the selected panel(s).

Layout variants ​

PropTypeDefaultDescription
accordionbooleanundefinedPanels are flush against each other: no gap when a panel opens, and the inner corner radii are squared off.
popoutbooleanundefinedPanels are inset (calc(100% - 32px)) and the active one grows past the container (calc(100% + 16px)).
insetbooleanundefinedThe inverse of popout: panels are full width and the active one shrinks (calc(100% - 32px)).
flatbooleanundefinedDrops the panel shadow (__shadow hidden, separator border removed) and suppresses the elevation output — useElevation(props, flat) returns nothing while it is on.

accordion, popout, inset and flat are independent booleans, not a single variant prop; combining them is allowed and each adds its own origam-expansion-panels--{name} class.

Forwarded to panels ​

PropTypeDefaultDescription
itemsIExpansionPanelProps[]undefinedData-driven panel list. Each entry is spread onto its <origam-expansion-panel>.
expandIconTIconundefinedCollapsed indicator for every panel.
collapseIconTIconundefinedExpanded indicator for every panel.
hideActionsbooleanundefinedHide the expand / collapse indicator on every panel.

⛔ expandIcon / collapseIcon / hideActions reach the panels through the items render path only (v-bind on the generated <origam-expansion-panel>). They are not part of the <OrigamDefaultsProvider> cascade below, so panels you write by hand in the default slot do not receive them — pass them on each panel, or switch to items.

The props that DO cascade to hand-written panels — through <origam-defaults-provider>, as defaults, so a panel setting its own still wins — are density, color, bgColor, rounded, border, eager and loadingText. Each is forwarded only when the consumer actually passed it (usePassedProps), because Vue coerces the unset value of the boolean-inclusive ones to a concrete false that would otherwise erase an ancestor's or a theme's value (#263).

Surface ​

PropTypeDefaultDescription
tagstring'div'Element rendered for the container.
colorTColorundefinedForeground colour. Also cascades to panels.
bgColorTColorundefinedBackground colour. Also cascades to panels.
elevationTElevationundefinedShadow rung. Suppressed by flat. Only the class channel is bound, so a free-form box-shadow string or the 2xl / 3xl rungs — which resolve through the inline-style channel — do not paint on the container.
roundedboolean | number | string | TRoundedundefinedCorner radius. Also cascades to panels.
border, borderTop, borderRight, borderBottom, borderLeft, borderBlock, borderInlineboolean | number | stringundefinedBorder widths. border also cascades to panels.
borderColorstringundefinedBorder colour for every edge.
borderStylestringundefinedBorder style.
borderTopColor, borderRightColor, borderBottomColor, borderLeftColorTColorundefinedPer-edge border colour.
densityTDensityundefinedDensity modifier. Also cascades to panels.

Spacing ​

PropTypeDefaultDescription
padding, paddingTop, paddingRight, paddingBottom, paddingLeft, paddingBlock, paddingInlineboolean | number | stringundefinedPadding on the container.
margin, marginTop, marginRight, marginBottom, marginLeft, marginBlock, marginInlineboolean | number | stringundefinedMargin on the container.

State ​

PropTypeDefaultDescription
hoverboolean | IStateEffectConfigundefinedtrue forces the hover state on; an object overrides the resting border / rounded / padding / margin while hovered.
activeboolean | IStateEffectConfigundefinedSame grammar, for the active state.
hoverClassstringundefined⛔ Declared but not rendered — same gap as on <OrigamExpansionPanelHeader>: useStateFlag's classes channel is not destructured here.
activeClassstringundefined⛔ Declared but not rendered — see above.

Lazy & loading ​

PropTypeDefaultDescription
eagerbooleanundefinedCascaded to panels: mount their content immediately instead of on first expand. The container owns no content of its own.
loadingboolean | number | TLoaderConfigundefinedAdds the loader class hook on the container only — the container paints no indicator. Put loading on a panel (or its content) for a visible one.
loadingTextstringundefinedCascaded to panels, where it becomes the loading renderer's label.

Common ​

PropTypeDefaultDescription
idstringgeneratedDOM id of the container.
classstring | string[] | objectundefinedExtra classes.
stylestring | string[] | object | StyleValueundefinedExtra inline styles.

Emits ​

EventPayloadWhen
update:modelValueanyThe group's selection changed. An array when multiple, a single value otherwise.

Per-panel selection is reported by <OrigamExpansionPanel> itself, which emits group:selected with { value: boolean }.

Slots ​

SlotScopeDescription
default—Replaces the whole generated list — write your <origam-expansion-panel> children here.
item{ collapseIcon, expandIcon, hideActions, item, index }Replaces the render of every entry of items.
item.{index}sameReplaces the render of one entry. Checked before item.
headerPartial<IExpansionPanelHeaderProps>Forwarded into each panel's #header.
prependIExpansionPanelHeaderSlotPropsForwarded into each panel's header #prepend.
titleIExpansionPanelHeaderSlotPropsForwarded into each panel's header #title.
appendIExpansionPanelHeaderSlotPropsForwarded into each panel's header #append.
wrapperPartial<IExpansionPanelContentProps>Forwarded into each panel's #wrapper.
content—Forwarded into each panel's #default (the body).

Every slot in the second half of the table also has an indexed twin — header.{index}, prepend.{index}, title.{index}, append.{index}, wrapper.{index}, content.{index} — checked first, with the unindexed name as fallback. All of them apply to the items render path; a default slot replaces that path entirely, so the per-panel forwards no longer apply.

Accessibility ​

  • The container itself carries no ARIA role. The header / content pair of each panel wires aria-expanded / aria-controls / aria-labelledby between themselves through the shared panel context.
  • Keyboard activation comes from each header being a real <button>; there is no roving-tabindex arrow-key navigation between panels.

Design tokens ​

The container reads no --origam-expansion-panels---* variable of its own beyond the radius rungs its rounded classes set. The layout variants read the panel-scoped ones:

CSS variableDefault
--origam-expansion-panel__popout---max-widthcalc(100% - 32px)
--origam-expansion-panel__popout---max-width-activecalc(100% + 16px)
--origam-expansion-panel__inset---max-width100%
--origam-expansion-panel__inset---max-width-activecalc(100% - 32px)
--origam-expansion-panel__accordion---header-overlay-transition0.3s
--origam-expansion-panel---transition-timing-functioncubic-bezier(0.4, 0, 0.2, 1)

Examples ​

Accordion, one panel at a time, always one open ​

vue
<template>
    <origam-expansion-panels accordion mandatory>
        <origam-expansion-panel title="Step 1" content="…"/>
        <origam-expansion-panel title="Step 2" content="…"/>
    </origam-expansion-panels>
</template>

Shared icons via the data path ​

vue
<template>
    <origam-expansion-panels
            :items="items"
            expand-icon="mdi:mdi-plus"
            collapse-icon="mdi:mdi-minus"
    />
</template>

Per-index title override ​

vue
<template>
    <origam-expansion-panels :items="items">
        <template #title.0="{ expanded }">
            <strong>{{ expanded ? 'Close' : 'Open' }} the first one</strong>
        </template>
    </origam-expansion-panels>
</template>
  • OrigamExpansionPanel — one collapsible panel.
  • OrigamExpansionPanelHeader — its toggling header.
  • OrigamExpansionPanelContent — its collapsible body.