Toast notifications are the silent but impactful communicators that tell your users what's up—without overstaying their welcome.
Whether you're celebrating a successful operation or showing a friendly error message, toasts are your solution.
Here’s a look at some popular JavaScript libraries that make implementing toasts a breeze, sorted by user favorites (stars).
4. Toastify.js
- GitHub Stars: 2.3k
- About: Pure JavaScript library for better notification messages.
- Why It's Great: If you’re all about simplicity and keeping things light, Toastify.js is a stellar choice. With no fancy dependencies or complex setup, it’s perfect for developers who want an elegant solution without the extra bloat.
Features:
- Minimal and straightforward.
- Easily add gradients or background images to your toast.
- Position notifications anywhere on the screen.
- Supports actions like clickable links.
🚀 Get Started:
Toastify.js Demo
apvarun / toastify-js
Pure JavaScript library for better notification messages
Toastify
Toastify is a lightweight, vanilla JS toast notification library.
Demo
Features
- Multiple stacked notifications
- Customizable
- No blocking of execution thread
Customization options
- Notification Text
- Duration
- Toast background color
- Close icon display
- Display position
- Offset position
Installation
Toastify now supports installation via NPM
- Run the below command to add toastify-js to your existing or new project.
npm install --save toastify-js
or
yarn add toastify-js -S
- Import toastify-js into your module to start using it.
import Toastify from 'toastify-js'
You can use the default CSS from Toastify as below and later override it or choose to write your own CSS.
import "toastify-js/src/toastify.css"
Adding ToastifyJs to HTML page using the traditional method
To start using Toastify, add the following CSS on to your page.
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
And the script at the bottom of the page
<
…3. React Hot Toast
- GitHub Stars: 10k
- About: Smoking Hot React Notifications 🔥
- Why It's Great: Built specifically for React, this library delivers hot, customizable, and lightweight notifications that blend seamlessly with your React apps.
Features:
- 🔥 Hot by default.
- 🎡 Promise API for automatic loaders based on promises.
- 🔧 Easily customizable.
- 👌 Lightweight—less than 5KB (including styles).
🚀 Get Started:
React Hot Toast Demo
timolins / react-hot-toast
Smoking Hot React Notifications 🔥
Features
- 🔥 Hot by default
- 🔩 Easily Customizable
- ⏳ Promise API - Automatic loader from a promise
- 🕊 Lightweight - less than 5kb including styles
- ✅ Accessible
- 🤯 Headless Hooks - Create your own with
useToaster()
Installation
With pnpm
pnpm add react-hot-toast
With NPM
npm install react-hot-toast
Getting Started
Add the Toaster to your app first. It will take care of rendering all notifications emitted. Now you can trigger toast()
from anywhere!
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>
)
…2. Toastr
- GitHub Stars: 12k
- About: Simple JavaScript toast notifications.
- Why It's Great: Toastr has been around for years and is known for its robust customization options. If you need flexibility and high configurability, Toastr is your best friend.
Features:
- Supports extensive customization options for colors, animations, and positions.
- Highly flexible API.
- Works with vanilla JavaScript and frameworks like jQuery.
🚀 Get Started:
Toastr Demo
toastr
toastr is a Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.
Browser testing provided by BrowserStack.
Current Version
2.1.4
Demo
- Demo can be found at http://codeseven.github.io/toastr/demo.html
- Demo using FontAwesome icons with toastr
CDNs
Toastr is hosted at cdnjs and jsdelivr
Debug
Minified
- //cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js
- //cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css
Install
Install-Package toastr
bower install toastr
npm install --save toastr
yarn add toastr
# Gemfile
gem 'toastr-rails'
# application.coffee
#= require toastr
// application.scss
@import "toastr";
Wiki and Change Log
Breaking Changes
Animation Changes
The following animations options have been deprecated and should be replaced:
- Replace
options.fadeIn
withoptions.showDuration
- Replace
options.onFadeIn
withoptions.onShown
- Replace
options.fadeOut
withoptions.hideDuration
- Replace
options.onFadeOut
withoptions.onHidden
Quick Start
3 Easy Steps
For other API calls, see the demo…
1. React Toastify
- GitHub Stars: 13k
- About: Extremely customizable and loved by many.
- Why It's Great: React Toastify takes the crown for ease of use and design elegance. Setting up notifications takes less than 10 seconds, making it a developer favorite.
Features:
- Super easy to customize.
- RTL support for multilingual apps.
- Swipe-to-close functionality (with customizable directions).
- Comes beautiful by default but allows extensive styling options.
🚀 Get Started:
React Toastify Demo
fkhadra / react-toastify
React notification made easy 🚀 !
React-Toastify
🎉 React-Toastify allows you to add notifications to your app with ease.
Installation
$ npm install --save react-toastify
$ yarn add 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>
);
}
Documentation
Check the documentation to get you started!
Features
- Easy to set up for real, you can make it work in less than 10sec!
- Super easy to customize
- RTL support
- Swipe to close 👌
- Can choose swipe direction
- Super easy to use an animation of your choice. Works well with animate.css for example
- Can display a react component inside the toast!
- Has
onOpen
andonClose
hooks. Both can access…
Final Thoughts
Whether you’re looking for simplicity or seeking advanced features, there’s a toast library out there for you:
- Keep it simple? Go for Toastify.js.
- React enthusiast? Try React Hot Toast or React Toastify.
- Customization king? Check out Toastr.
What’s your favorite toast library? Share your thoughts (and maybe a toast-worthy success story) in the comments below!
I’ve been working on a super-convenient tool called LiveAPI.
LiveAPI helps you get all your backend APIs documented in a few minutes
With LiveAPI, you can quickly generate interactive API documentation that allows users to execute APIs directly from the browser.
If you’re tired of manually creating docs for your APIs, this tool might just make your life easier.
Top comments (0)