InstallComponentsExample

Toast

Brief notifications in the bottom-right corner. Import toast from sidedish and call it from any client component.

How it helpsOne function call, with no provider or <Toaster /> to mount. Toasts go into a polite live region so screen readers announce them, and they dismiss themselves or on click.

Try it

"use client";

import { toast } from "sidedish";

export default function Example() {
  return (
    <>
      <button onClick={() => toast('Changes saved')}>Default</button>
      <button data-tone="good" onClick={() => toast('₹12,400 received', {title:'Payment', tone:'good'})}>Success</button>
      <button data-tone="warn" onClick={() => toast('82% of budget used', {tone:'warn'})}>Warning</button>
      <button data-tone="bad" onClick={() => toast('Could not sync', {title:'Error', tone:'bad', duration:6000})}>Error</button>
    </>
  );
}
<button onclick="Sidedish.toast('Changes saved')">Default</button>
<button data-tone="good" onclick="Sidedish.toast('₹12,400 received', {title:'Payment', tone:'good'})">Success</button>
<button data-tone="warn" onclick="Sidedish.toast('82% of budget used', {tone:'warn'})">Warning</button>
<button data-tone="bad" onclick="Sidedish.toast('Could not sync', {title:'Error', tone:'bad', duration:6000})">Error</button>

In Next.js

"use client";
import { toast } from "sidedish";

toast("Changes saved");
toast("Could not sync", { title: "Error", tone: "bad", duration: 6000 });

// After a Server Action:
const result = await saveAccount(form);
toast(result.ok ? "Saved" : result.error, { tone: result.ok ? "good" : "bad" });

API

NameTypeDescription
toast(msg, opts)functionShows a toast and returns its element.
opts.titlestringBold first line.
opts.tonegood | warn | bad | info | inkAccent colour.
opts.durationmsDefault 3500.