Toast

Short confirmations, built on Sonner. Sonner keeps what it is good at: stacking, expanding on hover, swipe to dismiss and alt+T to reach them. Kuori draws the toast itself, on Glass/Overlay in every theme.

Tones

The title is Label/MD, the description Body/XS text/tertiary. Tones bring a filled icon in their status colour; the neutral one has none. Use them for what just happened, never for errors you could show in place.

Archived
Reply sent to Mara
Couldn't refreshCheck your connection and try again.
Snoozed until tomorrow, 08:00
Refreshing your inbox

Showing one

Call toast() from client code. Anything you can take back gets an Undo action and stays 8 seconds instead of 5. Toasts sit bottom right, 24 in from the edges, and swipe away to the right. Press a button to try it.

Loading, then done

toast.loading() stays until you update it. Pass its id to the next call to turn it into the result in place.

Usage

import { Toaster, toast } from "@kuori/ui/toast";
// Once, in the root layout<Toaster />// Anywhere in client codetoast("Archived", { action: { label: "Undo", onClick: undo } });

toast(title, options)

PropTypeDescription
titleRequired
ReactNode
What happened, in sentence case: “Archived”
description
ReactNode
A second line, when the title needs one
action
{ label, onClick }
One action, usually Undo. It closes the toast
icon
IconName
A Kuori icon, for a neutral toast that needs one
duration
number
How long it stays, in msDefault: 5000, 8000 with an action
id
stringnumber
Reuse an id to update a toast in place

toast.success, .error, .warning, .info, .loading and .dismiss

PropTypeDescription
toast.success()
(title, options)
status/success/icon check
toast.error()
(title, options)
status/danger/icon warning circle
toast.warning()
(title, options)
status/warning/icon warning
toast.info()
(title, options)
status/info/icon info
toast.loading()
(title, options)
A spinner. Stays until updated by id
toast.dismiss()
(id?)
Close one toast, or all of them