# notistack

> Highly customizable notification snackbars (toasts) that can be stacked on top of each other

Latest version **3.0.2** (published 2025-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install notistack
pnpm add notistack
yarn add notistack
bun add notistack
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2025-01-18 |
| First published | 2018-08-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.0.0 |
| Dependencies | 2 |
| Unpacked size | 448.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4075 |
| Author | Hossein Dehnokhalaji |
| Maintainers | iamhosseindhv |
| Keywords | notistack, enqueueSnackbar, snackbarprovider, useSnackbar, multiple, react, javascript, material-ui, toast, redux, snackbar, stacked, notification, material design, hossein, dehnokhalaji, iamhosseindhv |

## Links

- npm: https://www.npmjs.com/package/notistack
- Repository: https://github.com/iamhosseindhv/notistack
- Homepage: https://www.notistack.com
- Issues: https://github.com/iamhosseindhv/notistack/issues
- Funding: https://opencollective.com/notistack
- npm.io page: https://npm.io/package/notistack

## Dependencies (2)

- [clsx](https://npm.io/package/clsx.md) ^1.1.0
- [goober](https://npm.io/package/goober.md) ^2.0.33

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 3.0.2 (latest) — 2025-01-18
- 3.0.0-alpha.13 (alpha) — 2023-03-05
- 1.0.6-next.3 (next) — 2021-09-11
- 1.0.10 (latest-mui-v4) — 2021-07-26
- 3.0.1 — 2023-03-08
- 3.0.0 — 2023-03-06
- 3.0.0-alpha.12 — 2023-03-05
- 2.0.8 — 2022-10-16
- 3.0.0-alpha.11 — 2022-10-16
- 3.0.0-alpha.10 — 2022-10-15
- 3.0.0-alpha.9 — 2022-10-15
- 2.0.7 — 2022-10-15
- 2.0.6 — 2022-10-15
- 3.0.0-alpha.8 — 2022-10-15
- 3.0.0-alpha.7 — 2022-06-26
- … 95 more at https://npm.io/package/notistack/versions

## README

<p align="center">
  <a href="https://notistack.com/" rel="noopener" target="_blank"><img src="https://user-images.githubusercontent.com/26996372/227733423-19064bf7-5176-4a0b-a1b6-cd80a7b32cdf.png" alt="notistack logo"></a></p>
</p>

<div align="center">

**[Notistack](https://notistack.com): Display notifications with call of a function.**

</div>

<div align="center">
Easy to use, customizable, smooth transitions, stack and queue them up!
</div>
<div align="center">
<a href="https://notistack.com">Documentation</a>
<span> · </span>
<a href="https://notistack.com/features/basic">Examples</a>
</br>
</br>

[![npm version](https://img.shields.io/npm/v/notistack.svg?label=version)](https://www.npmjs.com/package/notistack)
[![npm downloads](https://img.shields.io/npm/dm/notistack.svg)](https://www.npmjs.com/package/notistack)
[![package license](https://img.shields.io/npm/l/notistack.svg)](https://www.npmjs.com/package/notistack)

</div>


Table of Contents
--
- [How to use](#how-to-use)
- [Online demo](#online-demo)
- [Documentation](https://notistack.com/api-reference)

## Getting Started

Use your preferred package manager:
```
npm install notistack
yarn add notistack
```

#### Version guide
| Version | Notes 
| --- | --- |
| `v3.x.x` | Latest stable release. Standalone (i.e. not dependent on [material-ui](https://github.com/mui/material-ui)) |
| <= `v2.0.8` | Requires Material-UI v5 as peer dependency. `npm install notistack@2.0.8` |
| <= `1.0.10` | Requires Material-UI <= v4 as peer dependency. `npm install notistack@latest-mui-v4` |



### How to use

Instantiate a `SnackbarProvider` component and start showing snackbars: (see [docs](https://notistack.com/api-reference) for a full list of available props)

```jsx
import { SnackbarProvider, enqueueSnackbar } from 'notistack';

const App = () => {
  return (
    <div>
      <SnackbarProvider />
      <button onClick={() => enqueueSnackbar('That was easy!')}>Show snackbar</button>
    </div>
  );
};
```

Alternatively, You can use `useSnackbar` hook to display Snackbars. Just remember to wrap your app inside of a `SnackbarProvider` to have access to the hook context:

```jsx
import { SnackbarProvider, useSnackbar } from 'notistack';

// wrap your app
<SnackbarProvider>
  <App />
  <MyButton />
</SnackbarProvider>

const MyButton = () => {
  const { enqueueSnackbar, closeSnackbar } = useSnackbar();
  return <Button onClick={() => enqueueSnackbar('I love hooks')}>Show snackbar</Button>;
};
```

### Online demo

**Visit the [`documentation website`](https://notistack.com/features/basic) to see all the examples.**</br>
Or play with a minimal working example: [codesandbox](https://codesandbox.io/s/github/iamhosseindhv/notistack/tree/master/examples/simple-example??hidenavigation=1&module=%2FApp.js) </br>

### Contribution

Open an issue and your problem will be solved.

### Author - Contact

Hossein Dehnokhalaji

<a href="https://www.instagram.com/iamhosseindhv"><img src="https://github.com/iamhosseindhv/Rentaly/blob/master/Gifs/instagram.png" alt="Hossein Dehnokhalaji Instagram profile" align="right" width="32" height="32"/></a>
<a href="https://www.linkedin.com/in/iamhosseindhv"><img src="https://github.com/iamhosseindhv/Rentaly/blob/master/Gifs/linkedin.png" alt="Hossein Dehnokhalaji Linkedin profile" align="right" width="32" height="32"/></a>
<a href="mailto:hossein.dehnavi98@yahoo.com"><img src="https://github.com/iamhosseindhv/Rentaly/blob/master/Gifs/contact.png" alt="Hossein Dehnokhalaji email address" align="right" width="32" height="32"/></a>

---
_Source: https://npm.io/package/notistack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
