GithubX

Toast

A succinct, temporary notification.

## installation

pnpm dlx shadcn@latest add https://ascii.cnlibs.com/r/toast.json

## setup

Toasts are queued through a ToastProvider at the root of the tree and drawn by a single Toaster, which renders the queue in the top-right corner.

// app/layout.tsx (inside <body>)
import { ToastProvider, Toaster } from "@/components/ui/toast";

<ToastProvider>
  {children}
  <Toaster />
</ToastProvider>

## usage

const toastManager = ToastPrimitive.useToastManager()

toastManager.add({
  title: "Deployment queued",
  description: "main@a1b2c3d will build in ~40s.",
})

## success

type picks the tone; success renders in the primary color.

## error

## promise

One toast that shows a spinner while pending, then updates when the promise settles.

## persistent

timeout: 0 keeps a toast until it is dismissed.