Components

Toast

Lightweight notification component for alerts, confirmations, and messages. Includes variants, actions, undo behavior, and a dismiss button.

Your profile has been updated.

Payment Error

Your transaction could not be completed.

Item moved to trash.

E

Emily Stone

Sent you a message

Just now

Installation

Usage

Basic Toast

import { Toast } from "@/registry/core/toast";

export default function Demo() {
  return (
    <Toast
      variant="success"
      description="Your settings have been saved successfully."
    />
  );
}

Toast With Title & Actions

<Toast
  title="Payment Failed"
  description="Your card was declined. Please try again."
  variant="error"
  actions={{
    primary: {
      label: "Retry",
      onClick: () => console.log("Retry clicked")
    },
    dismiss: {
      label: "Cancel",
      onClick: () => console.log("Dismiss clicked")
    }
  }}
/>

Toast With Undo

Used when no title is present.

<Toast
  description="Item deleted."
  variant="warning"
  undoAction={() => console.log("Undo clicked")}
/>

Avatar Toast (Message-style)

import { AvatarToast } from "@/registry/core/toast";

<AvatarToast
  name="Alex Carter"
  description="Sent you a message"
  image="/images/user.jpg"
  status="online"
  time="2 minutes ago"
/>;

Variants

<Toast variant="success" description="Operation completed." />
<Toast variant="error" description="Something went wrong." />
<Toast variant="warning" description="Check your input again." />
<Toast variant="info" description="New update available." />
<Toast variant="message" description="1 new message." />

API Reference

Toast

PropTypeDefaultDescription
variant"success", "error", "info", "warning", "message"Controls icon and color theme
descriptionstringMain message text
titlestringOptional title for more structured toasts
undoAction() => voidShows an “Undo” button when no title is present
actions{ primary: { label: string; onClick?: fn }, dismiss?: { label: string; onClick?: fn } }Shows action buttons when title is present

AvatarToast

PropTypeDescription
namestringSender name
descriptionstringMessage body
imagestringAvatar image source
status"none", "online", "offline", "busy"Avatar status indicator
timestringTimestamp label

Accessibility

  • Dismiss buttons include visually hidden labels for screen readers.
  • Buttons follow standard focus handling and keyboard navigation.
  • Variant icons use meaningful symbols for visual association.
  • Layout works for both compact and content-heavy notifications.

Notes

  • If a title is present, the layout switches to a vertical content stack.
  • For simple toasts (no title), Undo appears inline on the right.
  • Icon colors are determined by variant.
  • Supports combining with a Toaster system (positioned stack) if needed.