SnackbarGroup

Feedback & Status
stable

Manages a queue of toast notifications stacked at a viewport anchor, driven by the useSnackbarGroup composable.

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

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

All props accepted by this component, with their type, default value and 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

Exposed members

Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.

<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.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

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

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

ARIA roles

region
status
alert

Keyboard interactions

Keyboard interactions
KeyAction
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.

Foundation

Design tokens

Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.

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.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Basic usage

vue

Locations

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.