A toast host built on Sonner, skinned as Mac OS X Growl-style smoked HUD panels with a glass top highlight, bold 13px white titles and a status glyph per type.
Installation
Requires the theme. Register the @skeuomorph namespace and add @skeuomorph/skeuomorph first, as shown in the installation guide. The CLI also pulls it in as a dependency.
Without the namespace, install straight from the URL:
Usage
Render the Toaster once, near the root of your app:
import { Toaster } from "@/components/ui/sonner"
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
<main>{children}</main>
<Toaster />
</body>
</html>
)
}Then call toast from anywhere:
import { toast } from "sonner"toast("Event has been created.")Examples
Notes
- Every toast type keeps the same smoked HUD panel in light and dark mode. The type shows in the glyph: a green LED for success, an "i" gel for info, an amber "!" gel for warning and a red "x" gel for error, so
richColorsis not supported. - Toasts slide 4px over 200ms in and 300ms out, and only fade under
prefers-reduced-motion.