Skip to content

Sonner (Toast)

Feedback

Toast notification system. Trigger with toast() from the sonner package.

DefaultSuccessErrorUndo action
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

Usage

Mount Toaster once in your application shell, then call toast from sonner in event handlers. Apex already mounts Toaster in its root layout. Never add a second Toaster in a page.

Import
import { Toaster } from "@dashboardpack/core/components/ui/sonner";

Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.

API reference

Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.

Sonner (Toast) props
PropType / DefaultDescription
richColors (Toaster)boolean

Default: false

Use semantic colors for success and error toasts.
closeButton (Toaster)boolean

Default: false

Show a dismiss button.
description (toast options)ReactNode

Default: —

Secondary message content.
action (toast options){ label, onClick }

Default: —

A recovery or follow-up action.
duration (toast options)number

Default: 4000

Visible duration in milliseconds.

Build with these too