Skip to content

toastr

A small jQuery library for showing non-blocking pop-up toast notifications on web pages.

Stars
12.1k
Forks
2k
Licence
MIT
Language
JavaScript
Last update
3.7 years ago
Type
Library

No commits in over a year — check for forks or alternatives before adopting.

What it is

Toastr is a JavaScript library that shows short, non-blocking notification messages (toasts) on a web page, such as info, success, warning, or error messages. Developers call a simple function like toastr.success with a message, and the notification appears and disappears without stopping the user from continuing to use the page. The README says jQuery is required.

  • Show a success message after a form is saved
  • Display an error toast when a request fails
  • Show a warning with a progress bar that counts down until it closes
  • Prevent identical messages from stacking by enabling preventDuplicates

Great for

  • Web developers who already use jQuery and want simple on-screen notifications
  • Developers maintaining existing jQuery-based sites
  • Teams who want a small, customizable notification library they can extend

Not ideal for

  • Projects that do not use jQuery, since the README says jQuery is required
  • Developers who want a modern, actively updated library, since the last push was in February 2023
  • Apps that need notifications beyond the page itself, such as native system alerts
Step-by-step guide: how to use toastrInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: jQuery

    Install with npm

    npm install --save toastr

    Install with yarn

    yarn add toastr
  2. 2

    Run it

    • Install toastr with npm or yarn, or link toastr.css and toastr.js from a CDN.
    • Include the CSS file with a link tag in your page.
    • Include toastr.js with a script tag after jQuery.
    • Call toastr.info('Your message') or another method to display a toast.
  3. 3

    Get the most out of it

    • Use toastr.options.preventDuplicates = true to avoid stacked identical messages
    • Set toastr.options.progressBar = true to show how long a toast remains
    • Enable toastr.options.closeButton = true to let users dismiss a toast manually
    • Use the onShown, onHidden, and onclick callbacks to respond to toast events
    • Set toastr.options.rtl = true for right-to-left languages

Downloads

Strengths

  • Simple API with info, success, warning, and error methods, as shown in the README
  • Options for timeouts, progress bars, close buttons, callbacks, and right-to-left layouts
  • Available through npm, yarn, NuGet, Bower, and CDNs

Trade-offs

  • Requires jQuery, which adds a dependency to your project
  • Last push was 2023-02-27 and the README lists version 2.1.4 while the latest release is 2.1.1, so maintenance status and version alignment are unclear
  • README includes a deprecation notice for older animation options that must be replaced

How it compares

ProjectStarsTypeLevelUpdatedBest for
toastr (this)12.1kLibrarybeginner3.7 years agoWeb developers who already use jQuery and want simple on-screen notifications
sweetalert218.1kLibrarybeginner9 days agoWeb developers who want nicer popups than the browser's built-in alert and confirm boxes

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.