Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 17, 2026·3 min de lecture

React Hot Toast — Lightweight Notification Toasts for React

A small, customizable toast notification library for React that provides promise-based toasts, accessible announcements, and smooth enter/exit animations with zero dependencies beyond React.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
React Hot Toast
Commande d'installation directe
npx -y tokrepo@latest install 339ec01d-81b9-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

React Hot Toast provides a minimal API for showing toast notifications in React applications. It focuses on developer experience with a single function call to trigger notifications and built-in support for promises, loading states, and custom rendering.

What React Hot Toast Does

  • Renders toast notifications with enter/exit animations using CSS transforms
  • Supports success, error, loading, and custom toast types via a single function API
  • Handles promise-based toasts that automatically switch between loading, success, and error states
  • Manages toast stacking, auto-dismiss timers, and pause-on-hover behavior
  • Provides accessible ARIA live region announcements for screen readers

Architecture Overview

The library uses a headless notification store that manages toast state independently from the render layer. The Toaster component subscribes to this store and renders positioned toast containers. Each toast is a lightweight object with type, message, and configuration. Animations are handled via CSS transitions rather than JavaScript animation libraries to keep the bundle small.

Self-Hosting & Configuration

  • Install via npm and add the Toaster component once at your app root
  • Configure default position with the position prop (top-center, bottom-right, etc.)
  • Set global defaults for duration, styling, and icon overrides via Toaster props
  • Use toast.custom for fully controlled rendering with your own components
  • Adjust the gutter and containerStyle props to match your layout spacing

Key Features

  • Under 5 KB gzipped with zero external dependencies
  • Promise API that tracks async operations and updates toast state automatically
  • Headless mode for using the notification store without the built-in renderer
  • Pause-on-hover and swipe-to-dismiss for desktop and mobile interactions
  • TypeScript support with full type definitions included

Comparison with Similar Tools

  • React Toastify — feature-rich with more built-in themes; React Hot Toast is smaller and more minimal
  • Notistack — designed for Material UI integration; React Hot Toast is framework-agnostic
  • Sonner — similar minimal approach with a different animation style and API design
  • SweetAlert2 — full modal dialogs; React Hot Toast is focused on non-blocking toasts

FAQ

Q: Can I show toasts from outside React components? A: Yes. The toast function works anywhere in your JavaScript code as long as Toaster is mounted.

Q: How do I customize the appearance of toasts? A: Pass a style or className prop to individual toast calls or set global defaults on the Toaster component.

Q: Does it support stacking multiple toasts? A: Yes. Toasts stack vertically and shift position as new ones appear or old ones dismiss.

Q: Can I use it with Next.js Server Components? A: The Toaster component and toast calls must run on the client. Mark them with "use client" in App Router projects.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires