Sonner screenshot

Sonner

Author Avatar Theme by Emilkowalski
Updated: 1 Apr 2025
10451 Stars

An opinionated toast component for React.

Overview:

Sonner is an opinionated toast component designed specifically for React applications. This library provides an easy way to display toast messages in your application. By adding to your app, you can render all your toasts in one centralized location. Sonner simplifies the process of showing toast notifications in React.

Features:

  • Opinionated Toast Component: Specifically designed for React applications.
  • Easy Installation: Simply add to your app to start using the toast component.
  • Versatile Usage: Use toast() from anywhere in your app to display toast messages.
  • API Documentation: Detailed API reference available in the documentation for easy reference.

Installation:

To install Sonner in your React project, follow these steps:

  1. Run the following command in your terminal to install Sonner:
    npm install sonner
    
  2. In your React application, import the component where you want to render your toasts:
    import { Toaster } from 'sonner';
    
  3. Add to your app component to set up your toast container:
    function App() {
      return (
        <div>
          <Toaster />
          {/* Other components */}
        </div>
      );
    }
    
  4. You can now use the toast() function from anywhere in your app to display toast messages.

Summary:

Sonner is a useful and straightforward toast component for React applications. With an opinionated design tailored for React, easy installation process, versatile usage, and detailed API documentation, Sonner simplifies displaying toast notifications in any React project. By following the installation guide and integrating in your app, you can quickly start utilizing Sonner to enhance user experience with toast messages.