Toast

Toast delivers short-lived feedback — saves, uploads, and errors that should not block the UI.

Mount one ToasterProvider near your app root, then call ToasterInjection::dispatch with ToastOptions or a composed Toast view. Stack position, timeout (default 8000 ms), queue limit, and hover-pause are provider defaults; override per toast when needed. ToasterInjection::dismiss_all clears only the nearest provider's toasts.

  • Confirmations that auto-dismiss (saved, copied, uploaded)
  • Errors with optional retry or undo in the footer
  • Non-blocking feedback while the user keeps working

Prefer MessageBar for persistent page or section status. Prefer Field validation for errors tied to a single form control.

  • Wrap your app shell in a single ToasterProvider.
  • From any descendant, call ToasterInjection::expect_context().dispatch(ToastOptions::new("…")).
  • Set intent, timeout, or position on ToastOptions; use timeout(-1) for persistent toasts.
  • For full slot control, pass ToastOptions::composed(|| view! { … }) with ToastTitle, ToastBody, and optional ToastFooter.
  • Dismiss by id with dismiss, or clear the provider stack with dismiss_all (scoped to that provider only).
Static composition

Compose title, body, and optional footer for inline documentation or layout previews without dispatching.

Saved
Your changes were saved.
Provider dispatch

Mount ToasterProvider and dispatch toasts via ToasterInjection::dispatch. Set intent to apply semantic background and border tokens from the theme.

Success intent

Success toasts use green semantic tokens for completed actions.

Uploaded
File upload completed.
Error with action

Error toasts can include a footer action for retry or undo. Use ToastOptions::footer_action_callback when the action should run custom logic.

Retries: 0

Bottom-end position

Stack toasts in the bottom-end corner for non-blocking notifications.

Custom timeout

Override auto-dismiss duration per toast. Negative values keep the toast until dismissed.

Persistent toast

Toasts with a negative timeout stay until explicitly dismissed.

Dismiss toast

Dispatch with a known id, then dismiss imperatively.

Dismiss all

Clear every visible and queued toast for this provider. Other preview examples on the catalog page use separate providers, so their toasts are not affected.

Dismiss with action

Footer actions that dismiss use ToastTrigger under the hood.

Composed dispatch

Same slot-based composition as static <Toast>, dispatched via ToastOptions::composed.

Default composition

Dispatch with ToastTitle, ToastBody, and ToastFooter slots. Uses the provider default auto-dismiss timeout (8000ms).

Offset

Adjust viewport inset (px from the stack edge). Position defaults to bottom-end; offset only changes how far the stack sits from the viewport edge.

Pause on hover

Hovering pauses the dismiss timer until the pointer leaves.

Toast limit

Extra toasts queue until a visible toast is dismissed.

Inline toaster

Render toasts inside a positioned container instead of a portal.

Toasts appear here
All positions

Dispatch toasts to each stack position, including per-toast overrides.