Sonner

Sonner

An opinionated toast component for React.
GitHub
5.33k
Created 10 months ago, last commit 9 days ago
32 contributors
167 commits
Stars added on GitHub, month by month
N/A
N/A
N/A
12
1
2
3
4
5
6
7
8
9
10
11
2022
2023
Stars added on GitHub, per day, on average
Yesterday
+8
Last week
+6.9 /day
Last month
+12.6 /day
Package on NPM
sonner
1.2.4
Monthly downloads on NPM
0
0
12
1
2
3
4
5
6
7
8
9
10
11
2022
2023
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

You can find out more about the API and implementation in the Documentation.