SnackbarGroup

Feedback & Status
stable

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.

Anatomy of OrigamSnackbarGroupSchematic of the SnackbarGroup component with 2 numbered internal parts. origam-snackbar-group (Teleport → body) __items (transition-group) origam-snackbar-item (intent=success) ← newest origam-snackbar-item (intent=info) 1 2
Anatomy of <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>. Positioned fixed per the location prop modifier class (e.g. --bottom-right).
2.origam-snackbar-group__items
<transition-group> wrapper. Renders each OrigamSnackbarItem with 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.

id
string
'default'
Identifier of the stack this container renders. Pair with useSnackbarGroup({ id }) to spawn items into the same stack.
location
'bottom-right'
Anchor location on the viewport. Drives both absolute positioning and the direction default.
max
number
5
Maximum number of items rendered concurrently. Oldest item is evicted FIFO when the cap is exceeded.
defaultDuration
number
5000
Default auto-dismiss timeout in milliseconds for items that do not supply their own duration. Pass 0 to make all items sticky.
spacing
string | number
'12px'
Gap between stacked items. Accepts a CSS dimension string or a number (converted to px).
Stacking order. Defaults to top-down for top-* locations and bottom-up for bottom-* locations.
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'div'
HTML element rendered as the stack root inside the Teleport to body.
attach
boolean | 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

region
status
alert

Interactions clavier

Interactions clavier
ToucheAction
TabMoves focus to the dismiss button or action buttons inside the visible toast items.
Enter / SpaceActivates 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.

Source
dimension
var(--origam-space---3)
Gap between stacked toast items.
dimension
420px
Maximum width of the stack container.
duration
var(--origam-motion__duration---fast)
Duration of the enter/leave slide transitions.
dimension
var(--origam-space---4)
Distance from the top edge for top-* locations.
dimension
var(--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

vue

Locations

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.