React Hot Toast Notifications

2.6.0 · active · verified Sun Apr 19

react-hot-toast is a highly regarded, lightweight, and customizable React notification library designed to display "smoking hot" toast messages with minimal setup and a beautiful default aesthetic. Currently stable at version 2.6.0, the package maintains an active and responsive release cadence, frequently introducing new features and performance enhancements. Notable recent updates include support for multiple toasters in v2.6.0, enhanced React Server Components (RSC) compatibility for Next.js 13 App Router in v2.4.1, and significant bundle optimizations in v2.3.0. Its key differentiators include a powerful Promise API that automatically handles loading, success, and error states, an exceptionally small bundle size of less than 5kb, and versatile headless hooks (`useToaster`) for developers requiring complete control over the UI. The library is built with accessibility in mind and ships with TypeScript types, promoting robust and type-safe development practices. It provides a simple `Toaster` component and a `toast` function that can be called anywhere in your application.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to integrate `react-hot-toast` by adding the `Toaster` component once to your application and then triggering notifications using the `toast` function from any part of your code. It shows a basic button click initiating a simple toast.

import toast, { Toaster } from 'react-hot-toast';
import React from 'react';

const notify = () => toast('Here is your toast.');

const App = () => {
  return (
    <div>
      <button onClick={notify}>Make me a toast</button>
      <Toaster />
    </div>
  );
};

export default App;

view raw JSON →