React Hot Toast

Lightweight, customizable toast notifications for React

Library
npm
v2.6.1
10,987 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
63 /100 Good
Development Activity 44
Maintenance 48
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 78
Code Quality 72
Innovation 88
Learning Curve 90

react-hot-toast is a lightweight notification library for React that renders customizable toast messages with sensible defaults for animation, positioning, and accessibility. It ships a single <Toaster /> component paired with an imperative toast() API, so triggering a notification from anywhere in your component tree requires no context providers, reducers, or global state wiring of your own.

Beyond basic toasts, it includes first-class support for promise-based flows via toast.promise(), which automatically transitions a toast between loading, success, and error states as an async operation resolves. The entire library — including its CSS-in-JS styling — is under 5kb, and a headless build (react-hot-toast/headless) exposes the same toast store without any bundled markup or styles for teams that want to render toasts with their own UI.

What You Get

  • A single <Toaster /> component that renders and positions all active toasts, with configurable placement (top-center, bottom-right, etc.), gutter spacing, and hover-to-pause behavior
  • An imperative toast() API with typed shorthand methods (toast.success, toast.error, toast.loading, toast.custom) plus toast.promise() for automatic loading/success/error transitions
  • Built-in accessibility via ARIA live-region props on every toast, and automatic respect for prefers-reduced-motion
  • A headless entry point (react-hot-toast/headless) exposing the same store and hooks without any bundled styles, for fully custom toast UIs
  • Multi-toaster support via a toasterId, letting different parts of an app render independent toast stacks

Common Use Cases

  • Confirming a successful form submission or save action with a brief, auto-dismissing toast
  • Surfacing API/network errors inline without redirecting the user or blocking the UI with a modal
  • Wrapping an async request (upload, mutation, fetch) in toast.promise() to show a single toast that morphs from loading to success/error
  • Building fully custom notification UI (branded styling, action buttons) on top of the headless store while keeping the timing/dismiss logic from the library

Under The Hood

Architecture — react-hot-toast is a React notification library built around three layers: a plain-object reducer/store (src/core/store.ts) that maintains toast state per “toaster ID” outside of React (module-level memoryState + listeners array), a toast() API surface (src/core/toast.ts) that dispatches actions (ADD_TOAST/UPSERT_TOAST/DISMISS_TOAST/REMOVE_TOAST) to that store, and a presentation layer (src/components/toaster.tsx, toast-bar.tsx, toast-icon.tsx) that subscribes via a useStore/useToaster hook and renders positioned toast elements using goober for CSS-in-JS styling and a MutationObserver-driven height-measurement callback (ToastWrapper) to compute stacking offsets without layout thrash. Pause/resume timers for hover are modeled as actions (START_PAUSE/END_PAUSE) that adjust each toast’s pauseDuration, keeping timing logic pure and testable in the reducer rather than scattered through components. The headless subpath entry (src/headless/index.ts) re-exports the same store/hooks without the styled components, letting consumers build a fully custom UI on the same state engine.

Tech Stack — TypeScript throughout (66% of repo bytes per GitHub language stats), bundled with tsup (dual CJS/ESM output plus type declarations, confirmed by the exports map in package.json), styled via goober (a ~1KB CSS-in-JS library) rather than a heavier styling dependency, and only two runtime dependencies (csstype, goober) — deliberately minimal given the “less than 5kb including styles” claim in the README, enforced by a size-limit config with per-bundle KB budgets. react/react-dom are peer dependencies (>=16), and a documentation site lives in site/ built with MDX content, separate from the library’s own build.

Code Quality — test/toast.test.tsx (534 lines) exercises the public toast API against a rendered <Toaster /> using @testing-library/react and Jest fake timers, covering dismiss/remove flows, promise-based toasts, and timing-sensitive behavior (a waitTime helper advancing jest.advanceTimersByTime) — the fake-timer discipline in beforeEach/afterEach (resetting all toasts, restoring real timers) suggests real attention to test isolation given the module-level mutable store. The source itself keeps functions small and single-purpose (the reducer in store.ts is a pure switch statement with no side effects), and naming is consistent (an ActionType enum, Toast/ToasterProps types collected in a single types.ts). No end-to-end or visual regression tests exist for the styled components — only behavioral/unit-level coverage.

API Design — The default export doubles as both a callable function (toast(message)) and a namespace of methods (toast.success, toast.error, toast.loading, toast.custom, toast.dismiss, toast.promise), which is a low-ceremony, highly discoverable pattern — a working toast requires exactly one <Toaster /> mounted plus a single toast(‘message’) call, per the README’s own quick-start. toast.promise() in particular collapses a common three-state UI pattern (loading/success/error) into one call. The headless export path is a deliberate extensibility seam for teams that want the state machine without the bundled UI/CSS.

Used by 23 apps in this directory

Python
53%
AGPL 3.0

LearnHouse

CMS · Learning Management

2,413

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
90
Repo Health
77
Technical
65
Dependency
Built with
Python 53%
TypeScript 45%
Updated 6 days ago
JavaScript
42%
Other

LimeSurvey

Forms Surveys

3,778

The world's most flexible open-source survey platform with 900+ templates, conditional logic, 80+ languages, and full GDPR compliance for any scale.

View details
86
Repo Health
62
Technical
62
Dependency
Built with
JavaScript 42%
PHP 36%
CSS 12%
Updated 6 days ago
TypeScript
93%
AGPL 3.0

Linkwarden

Bookmarks Archiving · Knowledge Management

20,195

Self-hosted collaborative bookmark manager that captures full-page archives, enables annotation, and keeps your knowledge accessible forever.

View details
90
Repo Health
72
Technical
66
Dependency
Built with
TypeScript 93%
Updated 6 days ago
TypeScript
98%
MPL 2.0

Logto

Authentication

14,769

Open-source auth infrastructure for SaaS and AI apps with OIDC, SAML, and RBAC

View details
92
Repo Health
83
Technical
63
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
Go
53%
MIT

memos

Note Taking

64,031

Open-source, self-hosted note-taking built for quick capture — Markdown-native, lightweight, and fully yours.

View details
91
Repo Health
78
Technical
65
Dependency
Built with
Go 53%
TypeScript 46%
Updated 6 days ago
TypeScript
85%
GPL 3.0

Notesnook

File Storage · Note Taking · Security

14,822

End-to-end encrypted, open-source note-taking where your data stays yours — even from the server.

View details
91
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 85%
JavaScript 12%
Updated 6 days ago
TypeScript
26%
AGPL 3.0

Omnivore

Bookmarks Archiving · Knowledge Management · Note Taking

16,356

Self-hosted read-it-later platform with highlights, newsletters, PDFs, and seamless Obsidian and Logseq integration.

View details
90
Repo Health
74
Technical
65
Dependency
Built with
TypeScript 26%
JavaScript 24%
HTML 20%
Updated 1 weeks ago
TypeScript
92%
Other

OpenHands

AI Code Assistants · AI Development

91,695

The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.

View details
91
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 92%
Updated 1 weeks ago
Elixir
55%
Other

Operately

AI Assistants · Collaboration · Productivity

592

The open source company operating system that unifies OKRs, projects, and team execution with built-in accountability cadences.

View details
86
Repo Health
80
Technical
74
Dependency
Built with
Elixir 55%
TypeScript 44%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers