For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
Shadcn Labs/

Toast Stack

Toast notifications that rise into a stack, slide away when dismissed and close the gap behind them. A React component built on View Transitions, installed with the shadcn CLI.

    Installation

    $ pnpm dlx shadcn@latest add @transition-kit/toast-stack

    Usage

    import {
      ToastProvider,
      ToastViewport,
      useToast,
    } from "@/components/transitions/toast-stack";
    <ToastProvider>
      <App />
      <ToastViewport className="fixed right-4 bottom-4 z-50" />
    </ToastProvider>
    const { toast, dismiss } = useToast();
     
    const id = toast({
      title: "Deploy finished",
      description: "Production is live at v2.14.0.",
    });
    dismiss(id); // one toast
    dismiss(); // all toasts

    Toasts dismiss themselves after duration. Hovering or focusing the stack pauses the timers.

    API Reference

    ToastProvider

    PropTypeDefaultDescription
    limitnumber3Most toasts on screen. The oldest leaves first.
    durationnumber4000Default milliseconds before a toast dismisses itself.

    toast(options)

    OptionTypeDefaultDescription
    titleReactNode-Toast heading.
    descriptionReactNode-Secondary text.
    actionReactNode-An extra control, e.g. an Undo button.
    durationnumberprovider'sMilliseconds before closing. Infinity stays.

    Returns the toast's id.