ExpansionPanel
Collapsible panel with animated header and content reveal. Supports accordion, popout and inset layout modes; optional loader, ripple and density controls.
Aperçu
Rendu de l’aperçu en cours…
defaultStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-expansion-panel> — 4 internal parts. The shadow ① is an absolutely-positioned sibling. Header ③ is a <button> with aria-expanded. Content ④ has role="region" and aria-labelledby pointing to the header.- 1.origam-expansion-panel
- Root element. Flex container for shadow, header and content.
- 2.origam-expansion-panel__shadow
- Absolutely positioned shadow layer. Uses box-shadow token. z-index: -1 prevents clipping content.
- 3.origam-expansion-panel__header / origam-expansion-panel-header
- Rendered as a
- 4.origam-expansion-panel__content / origam-expansion-panel-content
- Content region with role="region" and aria-labelledby. Animated via OrigamExpandY transition. Hosts the default slot.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- tagstring'div'
- HTML element rendered at the panel root.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- Header density: compact, comfortable or default.
- color
- Foreground colour for the panel header and content.
- bgColor
- Background colour of the panel surface.
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- elevationTElevation
- Box-shadow elevation. The shadow is rendered on a pseudo __shadow element so it does not clip the content.
- Border-radius of the panel. Applied to all four corners; the active panel resets the bottom radius.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- valueany
- Panel identifier used by the parent group to track selection. Auto-generated when omitted.
- disabledbooleanfalse
- Disables the panel header interaction. Sets aria-disabled and removes pointer events.
- selectedClassstring
- Icon shown in the header when the panel is collapsed.
- Icon shown in the header when the panel is expanded. Falls back to expandIcon with a 180deg rotation when not set.
- hideActionsbooleanfalse
- Hides the expand/collapse icon in the header.
- focusablebooleantrue
- Allows the header button to receive keyboard focus. Set to false only in non-interactive layouts.
- staticbooleanfalse
- Renders the header without expand/collapse behaviour — used to embed the panel inside custom workflows.
- readonlybooleanfalse
- Makes the panel non-interactive without disabling it visually.
- titlestring
- Panel header title text. Can also be set via the #title slot.
- appendAvatarstring
- appendIconTIcon
- prependAvatarstring
- prependIconTIcon
- prependAriaLabelstring
- appendAriaLabelstring
- rippleboolean | { class: string }true
- Material ripple on the header click. Set to false to disable.
- activeboolean | IStateEffectConfig
- activeClassstring
- hoverboolean | IStateEffectConfig
- hoverClassstring
- fontSizeTFontSize
- lineHeightTLineHeight
- contentstring | Component
- Content rendered inside the panel body. Accepts a plain string or a Vue component reference. Superseded by the default slot.
- eagerbooleanfalse
- When true, renders content immediately even when collapsed. Useful for SEO or when content must be mounted before first expand.
- Shows a progress loader at the top of the panel. Supports line, circular and skeleton modes.
- loadingTextstring
API
Slots
Emplacements de contenu exposés par ce composant.
- #loader
- Custom loader shown at the top of the panel when loading is active.
- #header
- Replaces the entire OrigamExpansionPanelHeader with custom markup.
- #prepend
- Leading area of the header (before the title). Typically an icon or avatar.
- #title
- Replaces the title text inside the header. Receives expand() method and isSelected boolean.
- #append
- Trailing area of the header (after expand/collapse icon).
- #wrapper
- Replaces the entire OrigamExpansionPanelContent wrapper.
- #default
- Panel body content rendered inside OrigamExpansionPanelContent.
API
Emits
Événements émis par ce composant.
- @group:selected{ value: boolean }
- Fired when the panel selection state changes inside its parent group.
API
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Filters and forwards a subset of props to header/content sub-components.
- Ref<string>
- Reactive CSS string generated by useStyle.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document.
- () => void
- Removes the injected style sheet.
- Ref<boolean>
- True once the style sheet has been injected.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Panel corner radius. Reset to 0 on inner panels in accordion/flat mode.
- Transition duration for margin, radius and max-width changes on expand/collapse.
- Margin applied above an active panel (and the panel following it) to visually separate it from siblings.
- Colour of the ::after separator line between panels (non-accordion mode).
- Opacity of the ::after separator. Fades to 0 adjacent to active panels.
- Box shadow of the elevation pseudo-element.
- Header minimum height at rest. Increases to 64px when the panel is active.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | Action |
|---|---|
| Enter / Space | Toggles the panel expanded/collapsed when focus is on the header button. |
| Tab | Moves focus to the next interactive element (next header or content). |
Notes
- The header button carries aria-expanded="true|false" reflecting the current panel state. Screen readers announce the expanded/collapsed status.
- The header button carries aria-controls pointing to the content region ID. The content region carries aria-labelledby pointing to the header ID.
- Disabled panels use tabindex="-1" on the header and add aria-disabled via the disabled HTML attribute.
- The expand/collapse animation respects prefers-reduced-motion: the transition-duration is overridden to 0ms.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- colorvar(--origam-color__surface---raised)
- Panel background — raised surface.
- dimensionvar(--origam-radius---sm)
- Panel corner radius.
- durationvar(--origam-motion__duration---slow)
- Transition duration for expand/collapse animations.
- dimensionvar(--origam-space---4)
- Margin above active panels (16px).
- dimension48px
- Header minimum height at rest.
- dimension64px
- Header minimum height when panel is expanded.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Sous-partie interne : elle est injectée par son composant parent et ne peut pas se rendre seule. Voir la fiche du composant parent pour un exemple vivant.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Basic accordion
Accordion mode (single open)
Data-driven via items prop
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.
ExpansionPanels
Container managing a group of ExpansionPanel items. Supports accordion, flat, popout and inset display modes.
ExpansionPanelHeader
Clickable header row with expand/collapse icon, prepend/append slots and ripple support.
ExpansionPanelContent
Animated content region revealed when the panel is expanded. Has role="region" and aria-labelledby pointing to the header.