Toast
Non-intrusive feedback. Auto-dismiss alerts. Confirm success instantly.
Installation
pnpm dlx nachui add toastAnatomy
Wrap your app with
Toast.Provider, then use useToast() anywhere:Variants
Default
All Variants
Five built-in variants:
default, success, error, info, and warning.With Action
Toast with an action button.
checkout-flow
Last deploy Mar 14, 3 environments
Active
Positions
Choose where toasts appear on screen. Click a position to select it, then trigger a toast.
API Reference
Toast.Provider
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | — | The app content. |
maxToasts | number | 5 | Maximum number of visible toasts. |
position | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "bottom-right" | Where toasts appear on screen. |
useToast()
Returns an object with:
| Method | Type | Description |
|---|---|---|
toast | (options: ToastOptions) => string | Shows a toast, returns its ID. |
dismiss | (id: string) => void | Dismisses a toast by ID. |
ToastOptions
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | Toast title (required). |
description | string | — | Optional description text. |
variant | "default" | "success" | "error" | "info" | "warning" | "default" | Visual variant. |
duration | number | 5000 | Auto-dismiss delay in ms. Set 0 for no auto-dismiss. |
action | { label: string; onClick: () => void } | — | Optional action button. |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.