Skip to contentKino
Skip to Content

Toast

A short message about something that just happened, in the corner of the screen. Each one stays open in a column, or they stack in a deck that spreads on hover.

npx shadcn add https://kinoui.com/r/toast.json
Share on

Examples

Default

Each toast stays open in a column in the corner, and a new one pushes the others up. In an app, ToastProvider and one Toaster go around it once, in the root layout.

Deck

With variant="deck" they stack behind the newest one, and hover or focus spreads them into a list.

Promise

One toast shows the work while it runs and turns into its result in place.

Installation

npx shadcn@latest add https://kinoui.com/r/toast.json
Files
components/kino/spinner.tsxlib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxlib/notice.tsxcomponents/kino/button.tsxcomponents/kino/toast.tsx
Packages
@base-ui/reactclass-variance-authority

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

ToastProvider

PropTypeDefaultDescription
limitnumber3How many show at once. Past it, the oldest leaves.
timeoutnumber5000How long a toast stays, in milliseconds, unless it sets its own. 0 keeps it until it is closed.
toastManagerToastManagerNoneA manager from createToastManager, to raise toasts from code outside React.

ToastViewport

PropTypeDefaultDescription
variant'list''deck''list'Every toast open in a column, or stacked until hover or focus spreads them.
containerHTMLElementRefObjectNoneWhere the toasts are rendered; <body> when left out.

CSS variables

VariableSet it onDefaultDescription
--toast-gapToastViewport, or <body>0.625remThe space between toasts in a list, and in a deck once it spreads.
--toast-peekToastViewport, or <body>0.625remHow much of each toast behind the front one shows in a deck.
--swap-rollToastViewport, or <body>0.75emHow far the icon rolls when a toast changes type, such as a spinner into a tick.
--swap-scaleToastViewport, or <body>0.97How far the icon shrinks as it changes.
--swap-blurToastViewport, or <body>2pxHow far the icon blurs as it changes.

Accessibility

  • Every toast is announced when it arrives. One with priority: "high" is announced at once, for something urgent.
  • F6 moves focus to the toasts, Tab moves between them, and Escape closes the one in focus. Their timers stop while the pointer or focus is on them.
  • A toast that needs an answer, such as a failed deploy, should stay (timeout: 0) and say what to do next.
  • When the system asks for less motion, toasts fade in and out where they are.