Skip to Content
zjkm-ui
Components

Toaster

Toast notifications that stack in a corner.

Props
4000ms
<Toaster />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/toaster.json
import { Toaster } from "@/components/toaster"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

Put <Toaster /> once in your layout, then call toast() from anywhere. Toasts stack in the corner, with older ones tucked behind; hovering or focusing the stack fans them out and pauses the timer. It sits fixed in the bottom-right corner of the window and announces itself politely to screen readers.

import { Toaster, toast } from "@/components/toaster";

export default function Layout({ children }: { children: React.ReactNode }) {
  return (
    <>
      {children}
      <Toaster />
    </>
  );
}

// Anywhere else:
toast("Changes saved", { description: "Your profile is up to date." });

Props

PropTypeDefaultDescription
durationnumber4000Milliseconds each toast stays.
toast(title, { description? })functionShows a toast and returns its id.
dismiss(id)functionRemoves a toast early.

With reduced motion, toasts appear and stack without animating.

On this page