Feedback
Toast
Bottom-right confirmation, 400px. Tone icon, title, description and optional action.
react-aria-componentslucide-react
Preview
128 prospects added to “Series B — VP Sales”
Start a sequence from the list when you are ready.
Export failed
The CSV was larger than 50 MB. Try fewer columns.
Salesforce sync started
We’ll let you know when 2,318 accounts are mapped.
AI found 38 new matches
For your saved search “Series B — VP Sales”.
"use client";
import { Button } from "@/components/ui/button";
import { Toast } from "@/components/ui/toast";
export default function Example() {
return (
<div className="grid w-full max-w-[816px] gap-3 md:grid-cols-2">
<Toast tone="success" title="128 prospects added to “Series B — VP Sales”" description="Start a sequence from the list when you are ready." onClose={() => {}} />
<Toast tone="error" title="Export failed" description="The CSV was larger than 50 MB. Try fewer columns." onClose={() => {}} />
<Toast tone="info" title="Salesforce sync started" description="We’ll let you know when 2,318 accounts are mapped." onClose={() => {}} />
<Toast
tone="ai"
title="AI found 38 new matches"
description="For your saved search “Series B — VP Sales”."
onClose={() => {}}
action={<Button size="sm">Review</Button>}
/>
</div>
);
}Installation
Components are copied into your project — no runtime package.
Install the following dependencies:
terminalnpm install react-aria-components lucide-reactCreate a
toast.tsxfile and paste the following code into it.src/components/ui/toast.tsx"use client"; import { CheckCircle2, Info, Sparkles, X, XCircle } from "lucide-react"; import type { ReactNode } from "react"; import { Button as AriaButton } from "react-aria-components"; import { cx } from "@/utils/cx"; export type ToastTone = "success" | "error" | "info" | "ai"; const icons: Record<ToastTone, { Icon: typeof Info; className: string }> = { success: { Icon: CheckCircle2, className: "text-success" }, error: { Icon: XCircle, className: "text-error" }, info: { Icon: Info, className: "text-info" }, ai: { Icon: Sparkles, className: "text-accent" }, }; export interface ToastProps { tone?: ToastTone; title: ReactNode; description?: ReactNode; action?: ReactNode; onClose?: () => void; className?: string; } /** Bottom-right confirmation, 400px. Tone icon + title + description + optional action. */ export function Toast({ tone = "success", title, description, action, onClose, className }: ToastProps) { const { Icon, className: iconClass } = icons[tone]; return ( <div role="status" className={cx("flex w-full max-w-[400px] items-start gap-3 rounded-md bg-surface p-3.5 shadow-popover", className)}> <Icon aria-hidden className={cx("mt-px size-4 shrink-0", iconClass)} /> <div className="min-w-0 flex-1"> <div className="text-base font-medium text-fg">{title}</div> {description && <div className="mt-0.5 text-sm text-fg-muted">{description}</div>} {action && <div className="mt-2.5 flex gap-2">{action}</div>} </div> {onClose && ( <AriaButton aria-label="Dismiss" onPress={onClose} className="-m-1 inline-flex size-6 items-center justify-center rounded-xs text-fg-muted outline-none data-hovered:bg-muted data-hovered:text-fg data-focus-visible:shadow-focus"> <X className="size-3.5" /> </AriaButton> )} </div> ); } /** Fixed bottom-right stack for toasts. */ export function ToastRegion({ children }: { children: ReactNode }) { return <div className="pointer-events-none fixed bottom-4 right-4 z-50 flex w-[400px] max-w-[calc(100vw-2rem)] flex-col gap-2 [&>*]:pointer-events-auto">{children}</div>; }Add the theme tokens and the
cxhelper from Installation if you haven’t yet, then update the import paths to match your project setup.