Installation
$ pnpm dlx shadcn@latest add @synccn/toastFirst time in this project? Connect synccn with one command.
Usage
import { Toaster, toast } from "@/components/ui/toast";// once, near the root<Toaster />// anywheretoast.success("Changes saved")API reference
Generated from the component's TypeScript types, so it always matches the code.
Toaster
Renders the toast stack. Mount once near the root of your app.
Takes no props.
toast
Shows a toast. Call it anywhere once <Toaster /> is mounted. toast("Saved"), toast.success(...), toast.error(...), toast.promise(...)
Takes no props.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for CheckCircle2, Info, Loader2, TriangleAlert, X, XCircle
Accessibility
- Toasts are announced through a polite live region. Hovering a toast pauses its timer.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: status
- ARIA attributes: aria-label, aria-live
- Announces changes to screen readers
More feedback
AlertInline message in five tones, with action and dismiss.ProgressLinear progress, determinate or indeterminate.Progress RingCircular progress with content in the middle.SkeletonShimmering placeholder while content loads.SpinnerEight-bar loading indicator.LoadersSix loading indicators: dots, bars, pulse, ring, orbit and typing.