suiss/ui · Component
Toast
Brief, stacked notifications that appear at the bottom of the screen and dismiss themselves.
Toast is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Toasts are built on the Base UI Toast primitive. Toaster is the ready-made setup: it combines ToastProvider, ToastPortal and ToastViewport, and renders each queued toast as a Toast with a ToastContent row holding a status icon, ToastTitle, ToastDescription, ToastAction and ToastClose.
New toasts stack at the bottom of the screen, with older ones scaled down behind, and expand into a list on hover or focus. A toast's type adds a colored icon: success, info, warning or error, or a progress ring for loading. Use toasts for short confirmations and background results; for messages that need a decision, use AlertDialog.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies and add the
cnhelper:
-
Add the pieces it builds on: Button.
-
Copy the source into
components/ui/toast.tsx:
- Update the import paths to match your project.
Usage
Render Toaster once near the root of your app, wrapping the content that shows toasts. Call toast.add({ title, description, type }) from anywhere, or read the manager inside the tree with useToastManager(). add returns an id that you can pass to close; close() with no id closes every toast.
Pass actionProps to show a ToastAction button, and timeout in milliseconds to change how long a toast stays; 0 keeps it until it's closed. toast.promise(promise, { loading, success, error }) shows a loading toast that turns into the success or error toast when the promise settles.
Toaster uses the shared toast manager by default. Pass toastManager to use one created with createToastManager() instead. Use the individual parts only to build a custom toast list.
Examples
Types
Shows each toast type with its icon and color.
Title only
Shows a toast with a title and no description.
With action
Adds an Undo action button that closes the toast.
Timeout
Compares a short timeout with a persistent toast that stays until closed.
Promise toast
Uses toast.promise to move from loading to success.
Promise rejected
Uses toast.promise to move from loading to an error when the promise rejects.
API Reference
ToastProvider
Provides a toast manager to the parts inside it.
Also accepts the props of ToastPrimitive.Provider.Props.
ToastPortal
Renders the viewport into a portal.
Also accepts the props of ToastPrimitive.Portal.Props.
ToastViewport
The fixed region at the bottom of the screen that holds the stack.
Also accepts the props of ToastPrimitive.Viewport.Props.
Toast
A single toast in the stack, positioned and animated by its index.
Also accepts the props of ToastPrimitive.Root.Props.
ToastContent
The row that lays out a toast's icon, text and buttons.
Also accepts the props of ToastPrimitive.Content.Props.
ToastTitle
The toast's title, which names it.
Also accepts the props of ToastPrimitive.Title.Props.
ToastDescription
Supporting text, which describes the toast.
Also accepts the props of ToastPrimitive.Description.Props.
ToastAction
An optional action button, rendered as a small outline Button.
Also accepts the props of ToastPrimitive.Action.Props.
ToastClose
An icon button that dismisses the toast.
Also accepts the props of ToastPrimitive.Close.Props.
Toaster
The complete setup: provider, portal, viewport and the rendered toasts.
Also accepts the props of ToastPrimitive.Provider.Props.
Accessibility
- The viewport is a
regionlandmark namedNotifications. - Each toast has the
dialogrole, named by its title and described by its description. ToastClosehas the accessible nameClose toast.- Prefer an action that can also be reached elsewhere, since toasts dismiss themselves after their timeout.
Notes
- On small screens the stack is centered at the bottom, inset from the edges and up to
max-w-smwide; from thesmbreakpoint it sits in the bottom end corner, up tomax-w-smwide. - Toasts can be swiped away; the exit animation follows the swipe direction.
- Parts carry
data-slotattributes such astoast-viewport,toast,toast-content,toast-iconandtoast-close. - Status icons are solid circles filled with
fill-green-500,fill-primary,fill-orange-500andfill-destructive, with a white glyph (text-primary-foregroundon the info icon); the loading ring usesstroke-primary. The ring's progress animation is removed when reduced motion is preferred.

Toaster wraps your app in a toast provider and renders the queue into a full-screen viewport. Each toast slides in from the bottom edge, fades out downward, and is capped at 384 points wide.
The viewport renders through a portal. On iOS it sits inside a FullWindowOverlay from react-native-screens, so toasts appear above native modals. Each toast is a Reanimated view.
Visible toasts stack with a small peek and shrink behind the frontmost one. Touching the stack expands it; it collapses again three seconds after the touch ends. Each toast shows an icon for its type (success, info, warning, error, or a spinner for loading), a title, a description, an optional action button and a close button.
Installation
The CLI also adds what it builds on: Button, Icon, Text. On React Native it also adds the animated view components/ui/animated-view.tsx.
Manual
- Install the dependencies:
-
Add the pieces it builds on: Button, Icon, Text, and the primitives
components/primitives/toast.tsx,components/primitives/use-render.tsx, and the animated viewcomponents/ui/animated-view.tsxfrom the next step. -
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the source into
components/ui/toast.tsx:
- Update the import paths to match your project.
- Install the dependencies:
-
Add the pieces it builds on: Button, Icon, Text, and the primitives
components/primitives/toast.tsx,components/primitives/use-render.tsx, and the animated viewcomponents/ui/animated-view.tsxfrom the next step. -
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the source into
components/ui/toast.tsx:
- Update the import paths to match your project.
- Install the dependencies:
-
Add the pieces it builds on: Button, Icon, Text, and the primitives
components/primitives/toast.tsx,components/primitives/use-render.tsx, and the animated viewcomponents/ui/animated-view.tsxfrom the next step. -
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the source into
components/ui/toast.tsx:
- Update the import paths to match your project.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Render Toaster once near the root, then call the exported toast manager from anywhere: toast.add({ title, description, type }) returns an id, toast.update(id, updates) changes a toast, and toast.close(id) removes it (or all toasts when called without an id).
toast.promise(promise, { loading, success, error }) shows a loading toast and replaces it with the success or error state when the promise settles.
Pass actionProps (for example { children: "Undo", onPress }) to show an action button. Set priority: "high" for urgent messages and timeout to override the provider default; loading toasts stay until updated.
Use createToastManager to create a separate manager and pass it to Toaster as toastManager, and useToastManager to read the current toasts and actions inside the provider. The lower-level parts are exported for building a custom toast layout.
Examples
Show on load
Shows a success toast as soon as the screen mounts.

API Reference
ToastProvider
Holds the toast queue, default timeout and visible limit.
Also accepts the props of ToastPrimitive.ProviderProps.
ToastPortal
Renders its children into a portal host.
Also accepts the props of ToastPrimitive.PortalProps.
ToastViewport
Full-screen layer that holds the stack and expands it on touch.
Also accepts the props of React.ComponentProps<typeof ToastPrimitive.Viewport>.
Toast
One animated, swipeable toast in the stack.
Also accepts the props of React.ComponentProps<typeof ToastPrimitive.Root>.
ToastContent
Row layout for the icon, text, action and close button.
Also accepts the props of React.ComponentProps<typeof ToastPrimitive.Content>.
ToastTitle
The toast title, read from the toast object.
Also accepts the props of React.ComponentProps<typeof ToastPrimitive.Title>.
ToastDescription
Secondary text under the title.
Also accepts the props of React.ComponentProps<typeof ToastPrimitive.Description>.
ToastAction
Outline button rendered from actionProps.
Also accepts the props of React.ComponentProps<typeof ToastPrimitive.Action>.
ToastClose
Icon button that dismisses the toast.
Also accepts the props of React.ComponentProps<typeof ToastPrimitive.Close>.
Toaster
Provider, portal and viewport that render the default toast list.
| Prop | Type | Default | Description |
|---|---|---|---|
portalHost | string | - | Name of the portal host to render into. |
Also accepts the props of ToastPrimitive.ProviderProps.
Accessibility
- Each toast has the
alertrole and a live region that ispolite, orassertiveforpriority: "high". - New toasts are announced with their title and description; high-priority announcements are not queued.
- A
dismissaccessibility action and the escape gesture close the toast. - Toasts stacked behind the front one are hidden from VoiceOver and TalkBack.
- The close button has the label "Close toast" and the type icon is hidden from assistive technology.
- Animations respect the system reduce motion setting.
Notes
- Uses
bg-popover,text-foreground,text-muted-foregroundand tint tokensbg-green-500,bg-primary,bg-orange-500andbg-destructivefor the icons. - Light and dark colors follow the system appearance; dark mode drops the border.
- Toasts respect the bottom safe area inset.
FullWindowOverlayis used on iOS only; Android renders the viewport directly.

