Deployment started
We will notify you when it completes.

Installation

Barrel

Granular

Usage

The toast system consists of two parts: the `Toasty` provider component and the `useKumoToastManager()` hook for triggering toasts.

function ToastTrigger() {
  const toastManager = useKumoToastManager();

  return (
    <Button
      onClick={() =>
        toastManager.add({
          title: "Success!",
          description: "Your changes have been saved.",
        })
      }
    >
      Save changes
    </Button>
  );
}

export default function App() {
  return (
    <Toasty>
      <ToastTrigger />
      {/* Rest of your app */}
    </Toasty>
  );
}

Setup

Wrap your application (or a section of it) with the `Toasty` provider. This sets up the toast context and renders the toast viewport.
// In your app root or layout

export function Layout({ children }) {
  return <Toasty>{children}</Toasty>;
}

Examples

Title and Description

A complete toast with both title and description.

Deployment started
We will notify you when it completes.

Title Only

A simple toast with just a title for brief messages.

Deployment started
We will notify you when it completes.

Description Only

A toast with only a description for more detailed messages.

Deployment started
We will notify you when it completes.

Success Variant

Use the success variant for confirmations and positive outcomes.

Deployment started
We will notify you when it completes.

Multiple Toasts

Multiple toasts stack and animate smoothly. Hover over the stack to expand them.

Deployment started
We will notify you when it completes.

Error Variant

Use the error variant for critical issues that need attention.

Deployment started
We will notify you when it completes.

Warning Variant

Use the warning variant for cautionary messages.

Deployment started
We will notify you when it completes.

Info Variant

Use the info variant for neutral informational messages.

Deployment started
We will notify you when it completes.

Custom Content

Use the content prop to render completely custom toast content.

Deployment started
We will notify you when it completes.

Action Buttons

Add action buttons to toasts for user interaction.

Deployment started
We will notify you when it completes.

Promise

Use the promise method to show loading, success, and error states automatically.

Deployment started
We will notify you when it completes.

API Reference

Toasty

The provider component that wraps your app and manages the toast system.

Props table: Toasty

useKumoToastManager()

A hook that returns the toast manager for creating toasts.

const toastManager = useKumoToastManager();

// Add a toast
toastManager.add(options);

// Promise-based toast
toastManager.promise(asyncFn(), {
  loading: options,
  success: (data) => options,
  error: (err) => options,
});

Toast Options

Options passed to toastManager.add() and promise handlers.

PropTypeDefaultDescription
titlestringThe toast title displayed prominently.
descriptionstringSecondary text displayed below the title.
variant"default" | "success" | "error" | "warning" | "info""default"Visual style of the toast.
contentReactNodeCustom content to render inside the toast. Overrides title and description.
actionsButtonProps[]Array of button props to render as action buttons.
timeoutnumber5000Time in milliseconds before the toast auto-dismisses.