Toast
GitHubColor-coded toast provider and helper for notifications, including feedback from ActionResult values.
Installation
bash
pnpm dlx shadcn@latest add @cs/toastUsage
tsx
import { Toaster, toast } from "@/components/cs/toast";tsx
<Toaster />;
toast.loading("Saving changes...");API Reference
Toaster
Renders color-coded info, success, warning, error, and loading notifications.
toast
Notification helper for application-level toast messages.
Methods
tsx
toast.info(message: string, options?: ToastOptions): voidShows an informational notification.
tsx
toast.success(message: string, options?: ToastOptions): voidShows a success notification.
tsx
toast.warning(message: string, options?: ToastOptions): voidShows a warning notification.
tsx
toast.error(message: string, options?: ToastOptions): voidShows an error notification.
tsx
toast.loading(message: string, options?: ToastOptions): voidShows a loading notification with a spinning indicator.
tsx
toast.dismiss(id: string): voidtsx
toast.actionResult({ status, message, toast }: ActionResult, options?: ToastOptions): voidShows feedback from an ActionResult, respecting its optional toast variant.