Toast
Lightweight notifications for creative app actions – export, delete, copy, save.
Install
Requires the sonner package and the Toaster component mounted in your layout (already included in the Substrate CLI scaffold).
npx shadcn@latest add https://substrate.georgedrury.co.uk/r/toastExamples
Default
"use client"
import { toast } from "@/components/substrate/toast"API
import { toast } from "@/components/substrate/toast"
toast("3 elements duplicated")
toast.success("Exported to PNG")
toast.error("Failed to save", { description: "Network unavailable" })
toast.warning("Unsaved changes")
toast.info("Tip: hold Shift for larger increments")
toast.undo("Deleted 2 elements", () => undo())
toast.dismiss()| Method | Default duration | Description |
|---|---|---|
toast() | 3s | Neutral notification |
toast.success | 3s | Success with checkmark icon |
toast.error | 5s | Error with longer display time |
toast.warning | 4s | Warning |
toast.info | 3s | Informational |
toast.undo | 5s | Message with an Undo action button |
toast.dismiss | — | Dismiss all toasts |