UIComponentsReact
Sonner
There is no Sonner item: Toast stands in for it, on the headless Toast.
Use Toast
shadcn's sonner item installs the sonner library. Here the same job is done by the Toast item, which adds no library: stacking, timeouts, swiping and the live region come from the headless Toast.
npx shadcn@4.23.0 add https://hamur.dev/r/react/toast.jsonFrom sonner
Render Toaster once, as with sonner, and call the layer's toast manager:
| sonner | Toast |
|---|---|
toast("Saved") | toast.add({ title: "Saved" }) |
toast.success("Saved") | toast.add({ type: "success", title: "Saved" }) |
toast.promise(p, { … }) | toast.promise(p, { … }) |
toast.dismiss(id) | toast.close(id) |
<Toaster position richColors /> | <Toaster limit timeout /> |
The Toast page lists the other differences.