Docs menu

Toast

Toasts smear in from the corner, squash against their stop and land in a puff of dust. The candy mark is a tiny face that reacts to the news, and an onomatopoeia sticker slams in beside it. Call toast() from anywhere.

Installation

❯ npx shadcn@latest add https://yan.moe/r/toast.json

Usage

tsx
// app/layout.tsx: mount it once
import { Toaster } from "@/components/ui/toast"

<Toaster />
tsx
import { toast } from "@/components/ui/toast"

toast("Mochi-chan says hi")
toast.success("Saved!", { description: "Your snack list is safe." })
toast.error("Oh no", { description: "The parfait fell over." })

toast() returns an id you can pass to toast.dismiss(id). At most four toasts are shown at once.

Accessibility

  • Built on Radix Toast: toasts are announced by screen readers, pause on hover and focus, and can be swiped away.
  • Press F8 to move focus to the toast region.
  • With prefers-reduced-motion: reduce, toasts appear without the smear, the dust or the sticker.

API

PropTypeDefault
intensity

Set on Toaster. kawaii: smear in, dust and a sticker. subtle: fade in with sparkles. off: just appear.

"kawaii" | "subtle" | "off""kawaii"
title

toast() option. The main line.

ReactNode-
description

toast() option. A second, quieter line.

ReactNode-
variant

toast() option. Sets the face on the candy mark and the colours.

"default" | "success" | "error""default"
duration

toast() option. Milliseconds before it leaves by itself.

number4000
sfx

toast() option. Sticker shown in kawaii mode. false hides it.

string | falseper variant