Library / SDK
iamhosseindhv/notistack avatar
iamhosseindhv/notistack

notistack: function-call snackbars for React, and how v3 dropped its MUI dependency

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

4,079 stars291 forksTypeScriptNOASSERTION

At a glance

What is it?
notistack queues and stacks toast notifications behind a single enqueueSnackbar call. Version 3.0.2 is standalone, so it no longer pulls Material-UI as a peer dependency, but it still expects a React 17 to 19 host.
Who is it for?
Adopt notistack if you already render React 17, 18 or 19 and want notifications triggered from plain functions outside the component tree, since enqueueSnackbar works without a hook. Skip it if you need a toast system for Vue, Svelte or vanilla JavaScript, because the package exposes React components and a React context and nothing else.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Activity is slowing. The repository last received commits 7 months ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • iamhosseindhv/notistack4,079 ★ · +1
Star history
Repository2026-09-232026-11-22
iamhosseindhv/notistack4.1k4.1k

1 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What notistack solves that a plain MUI Snackbar does not

A Material-UI Snackbar renders one message at a time and leaves the queueing to you. If three API calls fail within a second, a naive implementation either overwrites the first two messages or renders three snackbars on top of each other in the same corner. notistack takes over that job. Its own description is "Highly customizable notification snackbars (toasts) that can be stacked on top of each other", and the README's one-line pitch is "Display notifications with call of a function."

The audience is React developers who already have a component tree and want notifications to be fire-and-forget. The interesting part is where the call can come from. Because enqueueSnackbar is exported as a standalone function, you can call it from a fetch error handler, a Redux middleware or a plain utility module, places where a hook would be illegal. The hook form exists too, but it is not the only door in.

This matters most in codebases where notification triggers are scattered. If your error handling lives in an axios interceptor, a hook-only toast library forces you to plumb a callback down or move the logic into a component. notistack's standalone function removes that plumbing.

SnackbarProvider, context and the queue behind the stack

The architecture is a provider plus a context. You mount SnackbarProvider once, near the root, and every enqueue call either goes through the exported function or through useSnackbar, which reads the provider's context. The README is explicit about the constraint: "Just remember to wrap your app inside of a SnackbarProvider to have access to the hook context." Render a component that calls useSnackbar outside that provider and the context is missing.

The provider owns the list of visible and pending notifications. Stacking and queueing are its responsibility, not yours. The README describes the behaviour as "stack and queue them up", which is the distinction worth understanding: multiple snackbars can be visible at once, and additional ones wait rather than being dropped. The provider also carries the configuration surface. The README points to the API reference for "a full list of available props", and the related searches suggest position and close-button behaviour are the props people look for first.

Custom rendering is the other half. The repository ships examples/custom-content-example, examples/custom-snackbar-example and examples/custom-snackbar-example-2, so the intended path for anything beyond a text message is to supply your own component rather than fight the defaults. State-management integration is covered too: examples/redux-example and examples/mobx-example sit alongside examples/simple-example at the top level of the repository.

Installing notistack and firing your first snackbar

The README gives two package managers. Pick one; both install the same package.

bash
npm install notistack

or:

bash
yarn add notistack

Before you install, match the version to your Material-UI setup. The README's version guide is the authority here: v3.x.x is the latest stable release and is standalone, meaning it is "not dependent on material-ui". Version 2.0.8 and below require Material-UI v5 as a peer dependency, installed as [email protected]. Version 1.0.10 and below require Material-UI v4 or lower, installed as notistack@latest-mui-v4.

With the package in place, mount the provider and call the function. This is the README's own example, trimmed to the parts that matter:

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

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

Clicking the button should show a snackbar with the text "That was easy!". Note the shape of the provider element: it is self-closing in this example, so it is not wrapping the button. That is fine for the standalone function, which does not read context the way the hook does.

The hook form needs the provider to actually wrap your tree. The README's second example puts the provider around App and MyButton, then destructures both enqueueSnackbar and closeSnackbar from useSnackbar inside MyButton. If you want a dismiss control, closeSnackbar is the function the README names for that, and the related searches around a close button suggest it is a common first question.

Where notistack is the wrong choice

The package is React-only. The peer dependencies in package.json are react and react-dom, each pinned to ^17.0.0 || ^18.0.0 || ^19.0.0. If your application is Vue, Svelte, Angular or plain JavaScript, there is nothing here for you, and the React context that makes the provider work has no equivalent you can reuse.

The version table is the sharper trap. Because v3 is standalone, upgrading from 2.0.8 changes your dependency graph: the Material-UI peer requirement disappears. That is good news for bundle composition and bad news if your custom snackbar components were leaning on Material-UI internals that the library used to bring along. The repository carries MIGRATION.md at the top level, which tells you the maintainers expected breaking changes across major versions. Read it before you bump the version, not after.

Testing is the third gap. The package.json test script is literally "echo todo-test". There is no test suite in the repository to give you confidence that a version bump will not change stacking or queueing behaviour in your app. Whatever you rely on, you are verifying yourself. That is a real cost for a library that owns a piece of your UI's runtime behaviour.

The README's contribution section says "Open an issue and your problem will be solved." That is a promise about responsiveness, not a documented support policy, and it is not something you can schedule around.

notistack against react-toastify, react-hot-toast and sonner

The related searches name three alternatives directly: React-toastify, React-hot-toast and sonner. The honest difference is not features, it is coupling.

notistack is built for the Material-UI world. The topics list on the repository includes material-design and material-ui, and the README's whole version history is organised around which Material-UI generation you are on. If your app already uses MUI, the visual defaults and the custom-snackbar examples land in the same idiom as the rest of your interface. If your app does not use MUI, you are importing a library whose historical reason for existing was to make MUI snackbars stack properly.

react-toastify and react-hot-toast are not organised around a component framework. They ship their own presentation and expect you to style it. sonner is the same idea again with a different default look. Choosing between them is largely a question of which default appearance you want to override least.

The one thing that genuinely separates notistack's API from a hook-only toast library is enqueueSnackbar as a bare import. If your notification triggers live in non-component code, that is the feature to weigh, and it is the one the README leads with. If all your triggers are inside components anyway, the distinction evaporates and you should pick on styling and maintenance instead.

Licence, maintenance and what an upgrade actually costs

The repository's LICENSE.md and package.json both point to MIT, and the npm badge in the README is labelled "package license". The GitHub API reports the repository licence as NOASSERTION, which is a detection result rather than a conflicting claim; the package metadata is the clearer signal. As always, read LICENSE.md yourself rather than treating this as legal advice.

Maintenance is visible but not fast-moving. The last push to master was on 2026-03-31. The published version in package.json is 3.0.2, and the version guide treats v3.x.x as the current stable line. The repository has no published GitHub releases, so it does not show what changed between 3.0.x patch versions.

The upgrade cost concentrates in one place: the Material-UI boundary. Going from 2.0.8 to 3.x removes a peer dependency, which changes what your bundler resolves and what your custom snackbar components can assume. Going from 1.0.10 to 2.x moves you from Material-UI v4 to v5, which is a larger jump in the host framework than in notistack itself. Either way, MIGRATION.md is the file to read first, and the absence of a test script means the verification is on your side of the fence.

Editorial conclusion

Adopt notistack if you already render React 17, 18 or 19 and want notifications triggered from plain functions outside the component tree, since enqueueSnackbar works without a hook. Skip it if you need a toast system for Vue, Svelte or vanilla JavaScript, because the package exposes React components and a React context and nothing else. Before wiring it in, check the version table against your Material-UI version, because v3.x.x is standalone while 2.0.8 and earlier require Material-UI v5 and 1.0.10 and earlier require v4 or lower. Then read MIGRATION.md for the jump you are actually making, and note that the repository's test script is still echo todo-test, so there is no test suite to lean on when you upgrade.

Frequently asked questions

How do I use notistack in a React app?

Install the package with npm install notistack or yarn add notistack, then mount SnackbarProvider once near the root of your tree. After that you can call enqueueSnackbar from anywhere, or use the useSnackbar hook inside a component that sits under the provider.

How is notistack different from sonner?

notistack's version table is organised around which Material-UI generation a release requires, and v3.x.x is now standalone. sonner appears only as a related search phrase, so the repository gives no basis for a feature-by-feature comparison.

Does notistack require Material-UI?

Not in v3.x.x, which the README describes as standalone and not dependent on material-ui. Earlier lines do: 2.0.8 and below require Material-UI v5 as a peer dependency, and 1.0.10 and below require Material-UI v4 or lower.

Which React versions does notistack support?

The peer dependencies in package.json list react and react-dom at ^17.0.0 || ^18.0.0 || ^19.0.0, so React 17, 18 and 19 are the declared range.

Can I call notistack from outside a React component?

Yes. The README exports enqueueSnackbar as a standalone function and shows it being called directly from an onClick handler without going through the useSnackbar hook. The hook form does require your component to be wrapped in SnackbarProvider.

Official sources

  1. iamhosseindhv/notistack on GitHub
  2. Issues
  3. Project website
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/iamhosseindhv-notistack.svg)](https://hysenlabs.com/projects/iamhosseindhv-notistack)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/iamhosseindhv-notistack.svg)](https://hysenlabs.com/projects/iamhosseindhv-notistack)

Was this useful?