sonner

v2.0.7 MIT

An opinionated toast component for React.

Weekly Downloads
25.0M
Stars
12.2K
Forks
421
Open Issues
73
Gzip Size
13.9 kB
Unpacked Size
165.8 kB
Dependencies
3
Last Updated
8mo ago

sonner Download Trends

Download trends for sonner022.9M45.8M68.6M91.5MFeb 2025MayAugNovFebApr 2026
sonner

About sonner

Sonner provides a streamlined and visually appealing toast notification system for React applications. It addresses the common need for displaying transient user feedback, such as success messages, errors, or loading states, without cluttering the user interface. The component is designed to be highly customizable and easy to integrate, offering a polished experience out-of-the-box.

Sonner's core philosophy centers around developer experience and aesthetic quality. It aims to simplify the process of adding notifications, allowing developers to focus on application logic rather than UI details. The target audience includes React developers seeking a modern, opinionated solution that requires minimal configuration for excellent results. Its design prioritizes clarity and impact, ensuring that user messages are seen and understood.

Key API patterns revolve around a simple `toast()` function and hook-based interactions. Developers can invoke `toast.success('Operation completed!')`, `toast.error('Something went wrong.')`, or `toast.info('Processing request...')` directly. For more advanced control, custom render functions can be passed to `toast` calls, enabling complex JSX within notifications. It also supports imperative handling of toast lifecycles and themes.

Integration is seamless within the React ecosystem. Sonner works with any standard Create React App or Vite setup. It's compatible with modern React features like Concurrent Mode and Suspense. The package is designed to fit into existing component libraries and state management solutions without conflict, making it a flexible addition to many project architectures.

With a compact bundle size of 13.9 kB (gzip), Sonner adds minimal overhead to your application's load time. The package is actively maintained, as indicated by its last update in December 2025, and boasts significant community adoption with 12.0K GitHub stars. This maturity suggests a stable and reliable component suitable for production environments.

While Sonner is feature-rich, developers should note its opinionated nature. For extremely specific or unconventional animation requirements, or if a minimal, no-dependency toast solution is paramount, alternative approaches might be considered. However, for most common notification needs in React, Sonner offers a compelling balance of features, design, and ease of use.

When to use

  • When displaying success, error, or warning messages to users after an action.
  • When needing to inform users about background process status or updates.
  • When a visually distinct and customizable toast notification is required for branding.
  • When integrating notifications into a complex React application with minimal setup.
  • When leveraging the `toast()` function or `useToast` hook for imperative control.
  • When needing to render custom React components or complex JSX within notifications.

When NOT to use

  • If a notification system with extensive ARIA support and screen reader focus management is the absolute primary requirement, consider solutions built with accessibility as their core focus.
  • If an extremely lightweight, zero-dependency toast component with only the most basic features is needed, a simpler alternative may suffice.
  • If you require a notification system that integrates deeply with browser push notifications, Sonner's focus is on in-app UI.
  • When building a highly custom, non-React-based front-end, Sonner is specifically designed for React applications.
  • If the application's design mandates a non-standard animation or transition for notifications that Sonner cannot accommodate through its customization options.

sonner Alternatives

sonner Categories