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/toast

Examples

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()
MethodDefault durationDescription
toast()3sNeutral notification
toast.success3sSuccess with checkmark icon
toast.error5sError with longer display time
toast.warning4sWarning
toast.info3sInformational
toast.undo5sMessage with an Undo action button
toast.dismiss—Dismiss all toasts