Toast handbook
v2.3.3 · @snowui-design-system/components
License: Before reading component documentation, source, or npm usage instructions for the first time, read the full LICENSE. Reuse that review for the same task and version. Public API configuration and internal implementation changes have different license implications. All components use the unified runtime package; source rights remain governed by the license.
Overview
Show brief feedback for actions or status changes, with optional icons, actions, and rich content for success, errors, or reminders.
When to use it
Use Toast for short-lived action feedback through Toaster. Keep notification history and activity feeds in persistent content lists.
Call
toast()to enqueue feedback; Toaster manages the queue. When rendering Toast independently, the page removes it after close.as="toast"binds to a host click trigger. Leading/trailing roles add content;partsconfigures only generated controls. Use inheritedsingleLinewithText lines={1}for short labels. Internal content gaps stay at least 4 CSS px; rich multiline content retains its layout.
Quick start
This example shows the recommended basic composition. See the sections below for more cases and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only named public Props declared by this component.
Usage boundaries and details
Configuring Toast generated by Toaster
Toaster.parts.Toastconfigures generated Toasts.Toaster.parts.Textconfigures only labels generated from text strings; it does not configure custom children.Toaster owns queue state, position, and dismissal events. Explicit Toast Props override part settings.
SnowUI notification delivery has three public pieces:
Standalone panel Toast explicitly uses GENERIC_SCALE_APPEAR_MOTION for opacity and scale at the former Frame timing instead of inheriting whileAppear={true} fallback. Queued Toaster still uses its position-specific slide, opacity, and scale combination; both appearances are retained.
Feature overview
Six positions:
top,top-left,top-right,bottom,bottom-left, andbottom-right, 16px from the viewport edge; defaulttop.Leading/Content/Trailing slots; generated icons can be replaced externally.
Default variant is a dark pill with
blur(var(--size-10))backdrop blur. Rich variant is a Background/3 glass card using.snowui-quick-action-panelblur.Automatically dismiss after four seconds by default;
duration: 0persists.Hover pauses the dismissal timer; leaving resumes its remaining duration.
Toast stacks automatically at each position. Defaults:
gap=8,maxVisible=3,scaleStep=0.05,stackOpacityStep=0.2; width hugs content. These settings are configurable.One Toast root combines entry, exit, stack shifts, and pushed-out last layer. Lifecycle motion uses
transformand opacity; stack shifts and scale use independent CSStranslate/scale. Stack opacity multiplies Frame fade. On close, play Disappear before removing the queue entry.
Layout model
Main layout model: composite management layout.
Toaster mounts a page-level Portal on
<body>with six absolutely positioned stack regions. Each slot is an absolute Frame usingcurrentState="Appear" | "Disappear"for lifecycle motion.HeroUI-style stack indexing sets CSS
translateandz-index: index 0 is frontmost, and deeper items shift inward.Only the frontmost Toast is interactive. Deeper layers keep real content but differ by position, scale, and opacity.
An individual Toast uses a
Frame rowslot-host layout with Leading, Content, and Trailing.The rich variant’s close X is an absolute top-right decoration, outside the three slots.
toast(input) command API
Related functions:
dismissToast(id: string): voidcloses one Toast.dismissAllToasts(position?: ToastPosition): voidcloses all Toasts or those at one position.showToast(id: string, overrides?: ToastOptions): string | undefinedtriggers a registered<Toast template id="...">; overrides may change position, duration, and other runtime options.
<Toaster />
Motion behavior
Motion uses one Toast root:
Lifecycle
whileAppear/whileDisappearcontrols roottransformand--su-motion-opacity. Stack shifts and scale use independent CSStranslate/scale, so they do not overwrite the lifecycle transform.Stack opacity multiplies lifecycle fade. Layers two and three default to 0.8 and 0.6; exiting reduces the current opacity by 20%.
Extra offscreen exit distance merges into
--snowui-toast-stack-translate-yalongside lifecycle percentage motion, so deep layers can leave the viewport.Background, shadow, and
backdrop-filterstay on the same root; there is no separate blur plate.maxVisiblelimits visible layers, not queued entries. The old last layer enterspushed-outwhen a new Toast arrives.Hovering any visible Toast at a position pauses the whole group’s dismissal timers. Only the front
idlelayer reveals the close X; deeper layers do not.
Motion parameters
<Toast /> visual component
Inherits FrameProps except children, and adds:
Since v2.0.0,
title,description, andiconProps are removed. Pass text through children;positiveselects the generated icon, with no icon when omitted.
Global mount and command trigger
Standalone Toast (without toast())
Embedded as="toast" mode (v1.1.0)
An embedded Toast triggers on host click without an ID or manual showToast. See ComponentGuidelines §5 for floating components’ three activation modes (specs/maintainers/ComponentGuidelines.md).
Template declaration and button trigger
Replacing generated icons
This area is maintained by the user; please obtain permission before AI modification.
Toast style overlay
Read the full LICENSE first; reuse that review for the same task, version, and scope.
First use public component Props to match the desired appearance, preserving the existing look where possible. If changes are necessary, follow the style selection and override order: use your own class (including Tailwind already in the project) or an instance style. The names below are public overrides actually consumed by source; check their scope and do not modify private DOM. Choose the correct SnowUI token family. External apps need not install SnowUI website utilities.
Toast type and status
Required Props: no named required Props.
Bindable Props: this component declares no named two-way binding; handle state updates through public callbacks or its host.
Inheritance: Omit<FrameProps, "children">. Consult the base class public documentation; fields excluded by Omit cannot be passed through unchanged.
The following type declarations are actually referenced by public Props and come from source. A Svelte Snippet denotes a content fragment; ComponentProps denotes the Props of the corresponding component.
ComponentPartsOf
Source: components/src/logic/component-parts.svelte.ts
ConfigurableComponentPartProps
Source: components/src/logic/component-parts.svelte.ts
ComponentPartControlledKey
Source: components/src/logic/component-parts.svelte.ts
ToastVariant
Source: components/src/logic/toast.svelte.ts
ToastSize
Source: components/src/logic/toast.svelte.ts
ToastPosition
Source: components/src/logic/toast.svelte.ts