Rime

Toast

Frosted toasts for success, error, info and in-flight work, stacked as a deck that fans out on hover.

Mount ToastProvider once in the root layout and call useToast(). success and info leave after 5 seconds with a timer rule; error and loading stay until dismissed or settled. toast.promise shows loading, then success or error when the promise settles.

Installation

npx shadcn@latest add KezLahd/rime/toast

Also installs: base, icon, spinner.

Usage

import { useToast } from "@/components/ui";

const toast = useToast();
await toast.promise(save(), { loading: "Saving…", success: "Saved", error: "Couldn't save" });

Examples

The stack

ToastStackPreview draws the real stack in place, with no timers and no live region: loading, an error with an action, and a success.
  1. Saving changes…

  2. Invoice sent

    INV-1042 is on its way to Jane Cooper.

Tones

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

Toast per-component tokens
TokenDefaultLive value
--button-casenone…
--button-size-sm12.5px…
--button-tracking0…
--toast-blurblur(28px) saturate(180%)…
--toast-icon-radiusvar(--r-sm)…
--toast-radiusvar(--r-lg)…
--toast-rgb-error237, 93, 87…
--toast-rgb-info110, 84, 153…
--toast-rgb-success52, 168, 112…
--toast-surfacergba(var(--rgb-white), 0.82)…

System tokens it reads

Toast system tokens
TokenDefaultLive value
--brand-gradienttokens.css…
--danger-inktokens.css…
--densitytokens.css…
--durtokens.css…
--easetokens.css…
--ease-outtokens.css…
--focus-ringtokens.css…
--font-bodytokens.css…
--front-heighttokens.css…
--indextokens.css…
--ink-brandtokens.css…
--ink-headingtokens.css…
--ink-mutedtokens.css…
--ink-secondarytokens.css…
--line-brandtokens.css…
--line-brand-strongtokens.css…
--offsettokens.css…
--own-heighttokens.css…
--r-lgtokens.css…
--r-smtokens.css…
--r-xstokens.css…
--rgb-brand-deeptokens.css…
--rgb-contacttokens.css…
--rgb-whitetokens.css…
--success-gradienttokens.css…
--success-inktokens.css…
--text-bodytokens.css…
--text-smalltokens.css…
--toast-durationtokens.css…
--wash-activetokens.css…
--wash-strongtokens.css…
--wash-subtletokens.css…
--z-toasttokens.css…

Accessibility

  • The stack sits in a region labelled "Notifications" with a polite live list, and stays live while a Modal makes the rest of the page inert.
  • Hover or focus inside fans the stack out and pauses every timer; toasts never take focus.

Do and don't

Do

  • Confirm what was done, with the record's name or reference.

Don't

  • Don't put the only copy of important information in a toast.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open toast.md