Helper
React
Optional Toaster, React-aware toast with JSX icons, and custom().
Live demo and install on this page. Step-by-step guide:React docs.
The React entry is a Client Component, so Next.js App Router can import Toaster from a Server Component parent.
Try it
Same core toast API this stack uses.
Mode: success · position top-right · richColors on
Install snippet
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>)}>
Custom
</button>
</>
);
}- Toaster is optional. It only syncs config props.
- Import toast from alert-notify/react for JSX icons.
- custom() mounts React nodes into a toast body.
- Peer: react and react-dom >= 17.