SnackbarGroup
Manages a queue of toast notifications stacked at a viewport anchor, driven by the useSnackbarGroup composable.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-snackbar-group> — 2 internal parts. The root teleports to <body> and is positioned via the location prop; the __items wrapper hosts a <transition-group> animating each OrigamSnackbarItem.- 1.origam-snackbar-group
- Root element. Teleported to
<body>. Positionedfixedper thelocationprop modifier class (e.g.--bottom-right). - 2.origam-snackbar-group__items
<transition-group>wrapper. Renders eachOrigamSnackbarItemwith slide-up or slide-down enter/leave transitions.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- idstring'default'
- Identifier of the stack this container renders. Pair with useSnackbarGroup({ id }) to spawn items into the same stack.
- Anchor location on the viewport. Drives both absolute positioning and the direction default.
- maxnumber5
- Maximum number of items rendered concurrently. Oldest item is evicted FIFO when the cap is exceeded.
- defaultDurationnumber5000
- Default auto-dismiss timeout in milliseconds for items that do not supply their own duration. Pass 0 to make all items sticky.
- spacingstring | number'12px'
- Gap between stacked items. Accepts a CSS dimension string or a number (converted to px).
- direction
- Stacking order. Defaults to top-down for top-* locations and bottom-up for bottom-* locations.
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'div'
- HTML element rendered as the stack root inside the Teleport to body.
- attachboolean | string | Element | null
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>
- Utility to forward a filtered subset of props to a child component.
- ComputedRef<ReadonlyArray<ISnackbarGroupItem>>
- Computed slice of items currently rendered (capped to max, ordered per direction).
- Ref<string>
- Reactive CSS string generated by useStyle from the computed stack styles.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document. Called automatically on mount.
- () => void
- Removes the injected style sheet. Called automatically on unmount.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
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.
- Gap between stacked toast items. Overridden at runtime by the spacing prop.
- Maximum width of the stack container.
- Z-index of the teleported stack root.
- Distance from the viewport top edge for top-* locations.
- Distance from the viewport bottom edge for bottom-* locations.
- Distance from the viewport left edge for *-left locations.
- Distance from the viewport right edge for *-right locations.
- Duration of the slide-up / slide-down enter and leave transitions.
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 |
|---|---|
| Tab | Moves focus to the dismiss button or action buttons inside the visible toast items. |
| Enter / Space | Activates the focused dismiss or action button. |
Notes
- The stack root carries role="region" and aria-label="Notifications" so screen readers can navigate to the announcement zone.
- Each SnackbarItem inside the group carries aria-live="polite" (info, success) or aria-live="assertive" (warning, danger) so announcements are prioritised correctly.
- Slide transitions are replaced by an opacity-only fade under prefers-reduced-motion: reduce.
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.
- dimensionvar(--origam-space---3)
- Gap between stacked toast items.
- dimension420px
- Maximum width of the stack container.
- durationvar(--origam-motion__duration---fast)
- Duration of the enter/leave slide transitions.
- dimensionvar(--origam-space---4)
- Distance from the top edge for top-* locations.
- dimensionvar(--origam-space---4)
- Distance from the right edge for *-right locations.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Basic usage
Locations
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.