SnackbarGroup
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.
<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
All props accepted by this component, with their type, default value and 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
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
Keyboard interactions
| Key | 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.
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.
- 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.
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
Locations
Ecosystem
Family
Components from the same folder that share conventions and often compose together.