Toast

Headless toast primitives for Roblox UI with queue-based visibility and automatic dismissal.

Stable direction
@lattice-ui/toast

Part of the stable direction toward v1.0.

What It Is For

Use Toast for transient feedback that should queue, stack, and dismiss automatically without interrupting the main interaction flow.

It is appropriate for saved-state messages, undo affordances, and background task completion notices.

Preview size

Live demo is experimental and may contain bugs.

Install

Global CLI command: lattice add toast

Monorepo local script

Use your package manager wrapper when running the local lattice command.

pnpm lattice add toast

npm package: @lattice-ui/toast

Peer dependencies

  • @rbxts/react
  • @rbxts/react-roblox

Providers

  • @lattice-ui/layer:PortalProvider? (optional)

Registry notes

  • Toast viewport can be mounted with PortalProvider for layering.

Public Exports

  • Toast
  • Toast.Provider
  • Toast.Viewport
  • Toast.Root
  • Toast.Title
  • Toast.Description
  • Toast.Action
  • Toast.Close
  • dequeueToast
  • enqueueToast
  • getVisibleToasts
  • pruneExpiredToasts
  • useToast

State Model

  • Toast.Provider owns the full toast queue, the visible subset, the default duration, and the maximum visible count.
  • useToast() exposes the imperative queue API so any component in the provider tree can enqueue and clear toasts.
  • Toast.Root is presentation-oriented; queue lifecycle and timing live at the provider layer.

Key API

Toast.Provider

Use defaultDurationMs and maxVisible to define queue pacing and stacking behavior for the whole app.

useToast

Call enqueue, remove, and clear from application code without manually threading toast state everywhere.

Toast.Viewport

Mount the viewport once where toast surfaces should render and stack.

Toast.Action / Toast.Close

Use these parts for explicit user actions and dismiss controls inside the toast surface.

Composition Patterns

Global save feedback

Mount one provider and viewport high in the tree, then enqueue short descriptive toasts from feature code.

Undoable actions

Use Toast.Action when the toast should offer one meaningful follow-up action without becoming a full dialog.

Cautions / Limits

  • A provider without a mounted viewport can still manage queue state, but nothing will render visibly.
  • Toasts are intentionally transient; use Dialog or inline validation when the user must acknowledge or resolve something before proceeding.
  • Queue timing belongs to Toast.Provider; surface response and reduced-motion behavior belong in motion.