React

HelperOptional <Toaster /> near the root syncs config as props. Import toast from alert-notify/react when passing JSX icons. The React entry is a Client Component ("use client"). For a live demo and install snippet, see the React landing.

import { toast, Toaster, custom } from "alert-notify/react";

export function App() {
  return (
    <>
      <Toaster position="top-right" richColors />
      <button onClick={() => toast.success("Saved")}>Save</button>
      <button
        onClick={() =>
          toast.info("Pay with card", {
            icon: <img src="/card.png" alt="" />,
          })
        }
      >
        With icon
      </button>
      <button
        onClick={() =>
          custom(<div>Custom React content</div>, { autoClose: false })
        }
      >
        Custom
      </button>
    </>
  );
}