Short notices like “Saved” or “Deleted, undo?”. Call toast() from anywhere; render <Toaster /> once.
import { Toaster, toast } from "kivu-ui"On this page
import { Toaster, toast } from "kivu-ui";import { Button, Toaster, toast } from "kivu-ui";
export default function Demo() {
return (
<div className="flex flex-wrap gap-3">
<Button variant="soft" onClick={() => toast.success("Invoice sent", { description: "To amara@nyota.co" })}>Success</Button>
<Button variant="soft" tone="danger" onClick={() => toast.error("Payment failed", { description: "The card was declined." })}>Error</Button>
<Button
variant="outline"
onClick={() => toast({ title: "Deleted 3 projects", action: { label: "Undo", onClick: () => toast.info("Restored 3 projects") } })}
>
With undo
</Button>
{/* Render once, near the root of your app. */}
<Toaster position="bottom-right" />
</div>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | - | Required. Or pass a string: toast("Saved"). |
description | ReactNode | - | Second line. |
tone | "neutral" | "success" | "danger" | "info" | "neutral" | Or use toast.success / toast.error / toast.info. |
duration | number | - | ms before closing. Infinity keeps it open. |
action | { label, onClick } | - | One button, e.g. Undo. |
id | string | - | Update or dedupe an existing toast. |
| Prop | Type | Default | Description |
|---|---|---|---|
position | "top-right" | "top-center" | "bottom-right" | "bottom-center" | "bottom-left" | "bottom-right" | Where toasts appear. |
duration | number | 5000 | Default time on screen, in ms. |
max | number | 4 | Most toasts visible at once. |
Every component also accepts className and forwards its ref. Root CSS class: .kivu-toast