Sonner

An opinionated toast component for React.
GitHub
9.36k
Created 2 years ago, last commit 4 days ago
77 contributors
294 commits
Stars added on GitHub, month by month
2
3
4
5
6
7
8
9
10
11
12
1
2024
2025
Stars added on GitHub, per day, on average
Yesterday
+3
Last week
+5.4
/day
Last month
+7.7
/day
Last 12 months
+8.4
/day
npmPackage on NPM
sonner
1.7.4
Monthly downloads on NPM
2
3
4
5
6
7
8
9
10
11
12
1
2024
2025
No dependencies
README
SolarFlow.mp4

Sonner is an opinionated toast component for React. You can read more about why and how it was built here.

Usage

To start using the library, install it in your project:

npm install sonner

Add <Toaster /> to your app, it will be the place where all your toasts will be rendered. After that you can use toast() from anywhere in your app.

import { Toaster, toast } from 'sonner';

// ...

function App() {
  return (
    <div>
      <Toaster />
      <button onClick={() => toast('My first toast')}>Give me a toast</button>
    </div>
  );
}

Documentation

Find the full API reference in the documentation.