Sonner
A toast notification system powered by the Sonner library for elegant, non-intrusive alerts.
uiclass-variance-authoritylucide-reactnext-themessonner
Installation
$npx futureuikit add sonner
Import
import { Toaster } from "@/components/ui/sonner"
Layout Variant
Color Theme
Shape
Text & Icon Size
Spacing / Padding
Named Keys & Props
Pass these exact named keys as props on <Toaster />. Click any color pill to copy the prop.
colorDefault is "default"(Black & White)variantVisual style"solid""outline""ghost""glass""elevated""soft"shapeCorner shape"default""square""rounded""sharp"spacingInner spacing"default""2x""4x""6x""8x"sizeComponent size"default""sm""md""lg""xl"Usage Example
A basic implementation example to get you started.
Example Implementation
import { Toaster } from "@/components/ui/sonner";
import { toast } from "sonner";
export default function Example() {
return (
<div>
<Toaster />
<button onClick={() => toast("Hello from Sonner!")}>Show Toast</button>
</div>
);
}Features
Key capabilities and highlights.
Key Capabilities
- ◆Displays stacked toast notifications with smooth animations.
- ◆Supports success, error, info, and custom toast types.
- ◆Place the Toaster component once in your layout to enable toasts globally.
Notes
Important implementation details to consider.
Implementation Details
- ◆Install: Run 'npx futureuikit add sonner'.
- ◆Import: 'import { Toaster } from "@/components/ui/sonner";'
- ◆Usage: Add <Toaster /> to your root layout and call toast() anywhere to trigger notifications.