Reports the result of an action without interrupting: "Post published · View", "Moved to trash · Undo". Six tones with a thin status edge, actions, in-place updates by id, promise tracking, and a stack where only the front toast blurs.
Installation
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";
Usage
import { toast, Toaster } from "@vamos-ui/react";
// once, near the app root (App shell already includes it)
<Toaster />
toast.success("Post published", { action: { label: "View", onClick: openPost } });Critical information ("Couldn't save") must not live only in a toast — show an inline Alert too.
Only the first mounted Toaster renders, so a page-level one next to the App shell's never doubles toasts.
Import toast from @vamos-ui/react, never from the engine package, so it can be swapped later.
Examples
Undo (CRM)
A toast with an action stays at least 6 seconds. Undo should fully reverse the change.
- Elif Demir
- Can Yıldız
- Ayşe Kaya
- Mert Aksoy
Promise
toast.promise shows loading, then success or danger in the same toast, and returns the original promise.
Progress by id
Reuse the id to update one toast in place — a long export ends in a Download action.
API
toast(title, options) · toast.success · .info · .warning · .danger · .loading
| Prop | Type | Default |
|---|---|---|
titleShort past-tense result ("Leave approved"). | ReactNode | — |
descriptionOne line of detail. | ReactNode | — |
actionOne follow-up ("Undo", "View"). | { label: ReactNode; onClick: () => void } | — |
cancelA secondary, dismissing button. | { label: ReactNode; onClick?: () => void } | — |
durationneutral, success, info 4 s · warning 6 s · danger 8 s · loading until updated. Infinity keeps it. | number | 4000 / 6000 / 8000 / ∞ |
idSame id updates the toast in place. | string | — |
importantAnnounce assertively (role="alert"). Danger toasts always are. | boolean | false |
closeButton× on this toast. | boolean | false |
onDismiss / onAutoCloseLifecycle callbacks. | () => void | — |
→ returnsThe toast id. | string | — |
toast.promise(promise, messages)
| Prop | Type | Default |
|---|---|---|
loadingShown while pending. | ReactNode | — |
successShown on resolve. | ReactNode | (data) => ReactNode | — |
errorShown on reject. | ReactNode | (error) => ReactNode | — |
→ returnsThe original promise (handle its rejection). | Promise<T> | — |
toast.dismiss(id?)
| Prop | Type | Default |
|---|---|---|
idDismiss one toast, or all without an id. | string | — |
Toaster
| Prop | Type | Default |
|---|---|---|
positionLogical — end is the left edge in RTL. | "bottom-end" | "bottom-start" | "bottom-center" | "top-end" | "top-start" | "top-center" | "bottom-end" |
mobilePositionBelow 640px, away from the keyboard and bottom bars. | same | "top-center" |
maxVisible toasts before they stack. | number | 3 |
expandAlways show the stack expanded. | boolean | false |
closeButton× on every toast. | boolean | false |
hotkeyFocuses the toast region. | string[] | ["altKey", "KeyT"] |
offsetDistance from the viewport edge. | number | string | 24px |
labelsDictionary namespace "toast". | { region?: string; close?: string } | — |