JavaScript toast notification libraries

Updated Nov 2026

JavaScript toast libraries show short notification messages that appear over a page and close on their own. These libraries confirm events such as a saved setting, a sent message, or a failed upload without interrupting the page.

Popularity

Sonner has the most installs, while SweetAlert2 has the most GitHub stars.

LibraryMonthly downloadsStarsLast releaseLicense
Sonner
226.6M
13.2KAug 2026MIT
@radix-ui/react-toast
168.4M
19.5KOct 2026MIT
react-hot-toast
19.7M
11.0KSep 2026MIT
React-Toastify
19.6M
13.4KOct 2026MIT
Vue Sonner
12.0M
1.5KOct 2025MIT
Notistack
10.5M
4.1KJan 2025MIT
@zag-js/toast
6.8M
5.3KNov 2026MIT
SweetAlert2
4.7M
18.1KMay 2026MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Sonner is a styled toast component for React, built around a Toaster component that is mounted once in the app and renders the toasts. The toast function shows one from anywhere in the code, such as toast('Saved'). Variants of that function add action buttons and loading toasts that update when a promise settles. A separate package, Vue Sonner, ports the same component to Vue and Nuxt.

Downloads / mo
226.6M
Stars
13.2K
Last release
2.0.8
License
MIT

Strengths

  • Compact toast stack. Toasts stack tightly and expand when someone hovers over them.
  • Action buttons. Add a button that runs a callback and closes the toast.

Limitations

  • Big restyles go headless. For a very different look, use the headless option and render custom markup.

Quickstart

From README.md
$ npm install sonner
import { Toaster, toast } from 'sonner';

// ...

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

Sonner examples

From open-source projects on GitHub

@radix-ui/react-toast

@radix-ui/react-toast is the toast primitive from Radix, published inside the radix-ui package. Its parts, Toast.Provider, Toast.Root, Toast.Title, Toast.Action, and Toast.Viewport, ship unstyled, leaving all of the CSS to the app. Each toast closes after five seconds by default, with a timer that pauses on hover, focus, and window blur. A swipe gesture in the configured direction also dismisses a toast. Unlike Sonner, the primitive has no toast() function: each toast renders from React state through the open and onOpenChange props.

Downloads / mo
168.4M
Stars
19.5K
Last release
1.3.1
License
MIT

Strengths

  • Pauses on hover and focus. The close timer stops on hover, focus, and window blur.
  • Keyboard hotkey to toasts. A hotkey moves keyboard focus to the toast area.

Limitations

  • No toast() function. Render toasts from state, or write a custom imperative helper.

Quickstart

From toast.mdx
$ npm install radix-ui
import { Toast } from "radix-ui";

export default () => (
  <Toast.Provider>
    <Toast.Root>
      <Toast.Description>Saved!</Toast.Description>
      <Toast.Close>Dismiss</Toast.Close>
    </Toast.Root>
    <Toast.Viewport />
  </Toast.Provider>
);

@radix-ui/react-toast examples

From open-source projects on GitHub

react-hot-toast

react-hot-toast shows toasts in React through a toast function and a Toaster component that renders them. The README puts the library under five kilobytes, with its default styles included. A promise passed to the library shows a loading toast that turns into success or error when the promise settles. For a custom design, the useToaster hook returns the toast state and leaves the markup to the app, the same split that Sonner offers in its headless option.

Downloads / mo
19.7M
Stars
11.0K
Last release
2.6.1
License
MIT

Strengths

  • Fits a custom design. The useToaster hook handles state, and the app renders the toasts.
  • Promise toasts. One call shows loading, then success or error, as the promise settles.

Limitations

  • Loading toasts stay open. Update or dismiss a toast.loading notification when the work finishes.

Quickstart

From README.md
$ npm install react-hot-toast
import toast, { Toaster } from 'react-hot-toast';

const notify = () => toast('Here is your toast.');

const App = () => {
  return (
    <div>
      <button onClick={notify}>Make me a toast</button>
      <Toaster />
    </div>
  );
};

react-hot-toast examples

From open-source projects on GitHub

React-Toastify

React-Toastify shows toasts in React through the toast function, after a ToastContainer component is mounted once in the app. Each toast shows a progress bar for the time left before it closes. Toasts pause when the window loses focus and close on a swipe. Settings on the container limit how many toasts appear at once, while a single toast can render any React component, update after it opens, or close from code. Right-to-left layouts, dark mode, and stacked notifications are built in.

Downloads / mo
19.6M
Stars
13.4K
Last release
11.2.0
License
MIT

Strengths

  • Limits visible toasts. Set how many toasts can show at the same time.
  • Keyboard shortcut to toasts. Alt+T focuses the first toast, then Tab moves through its controls.

Limitations

  • Needs a ToastContainer. Mount ToastContainer in the app before calling toast.

Quickstart

From README.md
$ npm install --save react-toastify
  import React from 'react';

  import { ToastContainer, toast } from 'react-toastify';
  
  function App(){
    const notify = () => toast("Wow so easy!");

    return (
      <div>
        <button onClick={notify}>Notify!</button>
        <ToastContainer />
      </div>
    );
  }

React-Toastify examples

From open-source projects on GitHub

Vue Sonner is a Vue port of Sonner with default styles and swipe-to-dismiss. The port keeps Sonner's two parts: a Toaster component placed once, plus a toast function with variants for success, error, actions, and promises. Nuxt projects add the vue-sonner/nuxt module and call $toast from any component.

Downloads / mo
12.0M
Stars
1.5K
Last release
2.0.9
License
MIT

Strengths

  • Nuxt module included. Add vue-sonner/nuxt to the Nuxt modules, then call $toast in any component.
  • Promise toasts. One toast.promise call shows loading, then success or error.

Limitations

  • Import the stylesheet. Import vue-sonner/style.css alongside the Toaster component.

Quickstart

From README.md
$ npm install vue-sonner
<!-- App.vue -->
<template>
  <Toaster />
  <button @click="() => toast('My first toast')">Render a toast</button>
</template>

<script lang="ts" setup>
  import 'vue-sonner/style.css'
  import { Toaster, toast } from 'vue-sonner'
</script>

Vue Sonner examples

From open-source projects on GitHub

Notistack shows snackbars, short messages that stack on top of each other, in React. Each one starts with a call such as enqueueSnackbar('Saved') after a SnackbarProvider component is mounted. Inside that provider, the useSnackbar hook gives components the same call. From version three on, the library has no dependency on Material UI, which older versions required as a peer dependency.

Downloads / mo
10.5M
Stars
4.1K
Last release
3.0.2
License
MIT

Strengths

  • Caps the stack. Set maxSnack to limit how many snackbars show at once.
  • Blocks duplicate messages. Turn on preventDuplicate to stop the same message from showing twice.

Limitations

  • Needs a provider. Wrap the app in SnackbarProvider before calling the useSnackbar hook.

Quickstart

From README.md
$ npm install notistack
import { SnackbarProvider, enqueueSnackbar } from 'notistack';

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

Notistack examples

From open-source projects on GitHub

@zag-js/toast runs toast behavior as a state machine, a model that moves each toast through a fixed set of states. Zag's adapters connect the machine to React, Solid, Vue, or Svelte, which means a React project also installs @zag-js/react. A store made with toast.createStore keeps the placement and overlap settings. Calling toaster.create adds a toast with a title, a description, and a type such as info, success, or loading. Each type has its own default duration, from two seconds for success to no limit for loading. Like @radix-ui/react-toast, the package leaves the toast markup and styles to the app.

Downloads / mo
6.8M
Stars
5.3K
Last release
1.48.0
License
MIT

Strengths

  • Follows promises. One toast tracks a promise from loading to its result.
  • Priority queue. Queued toasts wait in priority order.

Limitations

  • The app builds the markup. Write the toast and toaster components and their styles by hand.

Quickstart

From usage.mdx
$ npm install @zag-js/toast
import * as toast from "@zag-js/toast"

const toaster = toast.createStore({
  overlap: true,
  placement: "top-end",
})

toaster.create({
  title: "Hello World",
  description: "This is a toast",
  type: "info",
})

@zag-js/toast examples

From open-source projects on GitHub

SweetAlert2 replaces the browser's alert, confirm, and prompt boxes with styled popup dialogs that follow WAI-ARIA, the web standard for accessible widgets. Setting toast: true turns a popup into a small notification that leaves the page usable. Swal.mixin saves a set of options, such as toast mode, position, and timer, after which each call to fire passes only the message. The package has no dependencies of its own; integration guides for React, Angular, and Laravel are linked from its README.

Downloads / mo
4.7M
Stars
18.1K
Last release
11.26.25
License
MIT

Strengths

  • Reusable toast presets. Create a toast preset with Swal.mixin, then call fire for each message.
  • Pause the close timer. Call stopTimer to hold the current toast open.

Limitations

  • Toasts never take focus. Toast mode doesn't move focus or block the page.
  • HTML isn't sanitized. Pass untrusted messages as text, or escape them before using html.

Quickstart

From the type definitions
$ npm install sweetalert2
import Swal from 'sweetalert2'

const Toast = Swal.mixin({
  toast: true,
  position: 'top-end',
  timer: 3000,
  timerProgressBar: true
})
Toast.fire('Something interesting happened', '', 'info')

SweetAlert2 examples

From open-source projects on GitHub

FAQ

In a React app, use Sonner: add one Toaster component, then call toast from anywhere. Choose react-hot-toast for rendering custom toast markup, and React-Toastify to limit how many toasts show at once. On a page with no framework, use SweetAlert2.

Add <Toaster /> to the app once, then call toast('Saved') from any component. Use toast.success, toast.error, or toast.promise for the common states.

The shadcn/ui toast component depends on @radix-ui/react-toast. Radix supplies unstyled, accessible toast parts, and shadcn/ui adds the styles.

Use Vue Sonner, a Vue port of Sonner that includes a Nuxt module. @zag-js/toast also has a Vue adapter for writing custom toast markup.

No. Radix Toast provides unstyled, accessible parts, and the app supplies the CSS. It still closes toasts on a timer, pauses them on hover and focus, and supports swipe to dismiss.

Use react-hot-toast to render a custom toast design, since its headless hook manages state without rendering anything. Use React-Toastify for built-in queue limits and a keyboard shortcut that focuses toasts.

For coding agents

Found your toast notification library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official