Sonner
Toast notifications — mount `<Toaster />` once, then call `toast()` anywhere.
Updated
Trigger a toast
// mount once at the app root:
<Toaster />
<Button variant="outline" onClick={() => toast("Event has been created")}>Show toast</Button>Toast notifications — mount <Toaster /> once, then call toast() anywhere.
Installation
railbase ui add sonner
Peer dependencies:
npm install @preact/signals
Note
railbase ui add also copies shared primitives — they ship alongside this component automatically.
Usage
import { Toaster } from "@/lib/ui/sonner";
// app root:
<Toaster />
// anywhere:
toast("Saved");
toast.error("Something went wrong");
Anatomy
Exported parts: dismissToast · toast · Toaster