Skip to content

Toast

Short floating confirmations with auto-dismiss.

New version

Atomus 4.0 is ready.

ToastLive · light and dark follow the theme switch

Add the source to a shadcn project

npx shadcn@latest add https://docs.atomus.io/r/toast.jsonOpen in v0

Installs the component source, its CSS and the Atomus tokens into components/atomus/. How the registry works

From guidelines/components/message-alert.md · Open in Figma: Toast

Properties, variants and anatomy of the Figma components. React props use the same names.

Floating notification; auto-dismiss in code.

Variants: 5

Property Type / options
Title text
Description text
Close boolean (on)
Color Brand · Gray · Error · Warning · Success
import { Toast, ToastProvider, useToast } from '@stanvision/atomus-react';
// once, at the app root
<ToastProvider>{app}</ToastProvider>
// anywhere inside
const toast = useToast();
toast.show({ color: 'success', title: 'Changes saved' });

A short, floating confirmation. Wrap the app in ToastProvider and call useToast().show({...}).

Full types and defaults are in React API at the end of the page.

  • title, description, color (brand · gray · error · warning · success), an optional action.
  • duration in ms (default 5000; errors stay until closed). Hover or focus pauses the timer.
  • ToastProvider position — bottom-right (default), top-right, bottom-center; at most 4 at once.

From the Figma guidelines.

Do

  • Use for short confirmations of something the user just did (“Changes saved”).
  • Keep it to a title, an optional one-line description and at most one action.
  • Keep error toasts open until the user closes them.

Forbidden

  • Never put critical information or a required decision in a toast — use Alert or Modal.
  • Never show more than one toast for one event.

Generated from react/src/components by scripts/gen-react-api.mjs — the same tables agents read in guidelines/components/message-alert.md.

Use only these props; anything else is not part of the API.

Figma: Toast — a single floating notification. Use ToastProvider + useToast to show them.

import { Toast } from '@stanvision/atomus-react'; — source: react/src/components/Toast.tsx

Prop Type Default Description
title ReactNode required Figma: Title
description ReactNode — Figma: Description
color 'brand' | 'gray' | 'error' | 'warning' | 'success' 'gray' Figma: Color
onClose () => void — Figma: Close
action ReactNode — Action element, e.g. a link-style Button.
className string — Extra class on the root element (layout only — never restyle colours or sizes).

Accepts only the props above.

Hosts toasts. Pauses auto-dismiss on hover and focus.

import { ToastProvider } from '@stanvision/atomus-react'; — source: react/src/components/Toast.tsx

Prop Type Default Description
children ReactNode required Content.
position 'top-right' | 'bottom-right' | 'bottom-center' 'bottom-right' Where toasts appear.

Accepts only the props above.

import { useToast } from '@stanvision/atomus-react'; — source: react/src/components/Toast.tsx

Hook. Returns { show: (t: ToastOptions) => string; dismiss: (id: string) => void }. Call it inside <ToastProvider>: const { show, dismiss } = useToast(); show({ title: 'Saved', color: 'success' }). show takes ToastOptions (the Toast props plus duration in ms; 0 keeps it open) and returns the toast id.