npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

toster-js

v1.1.0

Published

A lightweight, customizable toast notification library with Tailwind CSS styling

Downloads

8

Readme

Toster.js 🍞

A lightweight, customizable toast notification library with Tailwind CSS styling. Perfect for modern web applications that need beautiful, accessible toast notifications.

Features

  • 🚀 Zero Configuration - Automatically loads Font Awesome and Tailwind CSS
  • 🎨 Tailwind CSS Ready - Works seamlessly with Tailwind CSS
  • 🌙 Dark Mode Support - Built-in light and dark themes
  • 📱 Mobile Friendly - Responsive design that works on all devices
  • 🎯 Smart Dependencies - Detects existing dependencies, no duplicates
  • Lightweight - Only ~3KB minified
  • 🎭 Customizable - Full control over styling and behavior
  • 🔧 Easy to Use - Simple API with sensible defaults
  • Accessible - Built with accessibility in mind

Installation

npm install toster-js

Quick Start

Option 1: Zero Configuration (Recommended)

Just include Toster.js and it will automatically load Font Awesome and Tailwind CSS if they're not already present:

<!-- Only include Toster.js - dependencies loaded automatically -->
<script src="node_modules/toster-js/dist/toster-js.js"></script>
// Basic usage - works immediately
toster.success('Operation completed successfully!');
toster.error('Something went wrong!');
toster.warning('Please check your input!');
toster.info('Here is some information!');

Option 2: Manual Dependencies (For Existing Apps)

If your app already has Font Awesome and Tailwind CSS, Toster.js will detect them and won't load duplicates:

<!-- Your existing dependencies -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<script src="https://cdn.tailwindcss.com"></script>

<!-- Include Toster.js -->
<script src="node_modules/toster-js/dist/toster-js.js"></script>
// Works with existing dependencies
toster.success('Operation completed successfully!');

API Reference

Basic Methods

toster.success(message, title, options)

Shows a success toast with green styling.

toster.success('Data saved successfully!');
toster.success('Profile updated!', 'Success');

toster.error(message, title, options)

Shows an error toast with red styling.

toster.error('Failed to save data!');
toster.error('Network error occurred!', 'Error');

toster.warning(message, title, options)

Shows a warning toast with yellow styling.

toster.warning('Please review your input!');
toster.warning('Session will expire soon!', 'Warning');

toster.info(message, title, options)

Shows an info toast with blue styling.

toster.info('New features available!');
toster.info('System maintenance scheduled!', 'Info');

toster.custom(config)

Shows a custom toast with full control over styling.

toster.custom({
  icon: 'fa-star',
  iconColor: 'text-purple-500',
  borderColor: 'border-purple-500',
  title: 'Custom Toast',
  message: 'This is a custom styled toast!',
  theme: 'dark'
});

Configuration Options

All methods accept an options object as the last parameter:

{
  autoClose: true,           // Auto-close the toast (default: true)
  autoCloseDelay: 8000,      // Delay in milliseconds (default: 8000)
  theme: 'light',            // 'light' or 'dark' (default: 'light')
  position: 'bottom-right'   // Toast position (default: 'bottom-right')
}

Advanced Usage

Custom Styling

toster.custom({
  icon: 'fa-heart',
  iconColor: 'text-pink-500',
  borderColor: 'border-pink-500',
  title: 'Custom Toast',
  message: 'This toast has custom styling!',
  autoClose: false,
  theme: 'dark'
});

HTML Content

toster.info('This message contains <strong>HTML formatting</strong>!');
toster.success('Click <a href="#" onclick="doSomething()">here</a> to continue!');

Manual Close

const toast = toster.warning('This toast must be closed manually!', 'Manual Close', {
  autoClose: false
});

// Close programmatically
toast.click(); // or use the close button

Examples

Basic Notifications

// Success notification
toster.success('Your changes have been saved!');

// Error notification
toster.error('Failed to connect to server!');

// Warning notification
toster.warning('Your session will expire in 5 minutes!');

// Info notification
toster.info('New updates are available!');

Custom Notifications

// Custom success with different title
toster.success('Profile picture updated successfully!', 'Profile Updated');

// Custom error with longer auto-close delay
toster.error('Server maintenance in progress!', 'Maintenance', {
  autoCloseDelay: 15000
});

// Custom warning that doesn't auto-close
toster.warning('Please save your work before continuing!', 'Save Required', {
  autoClose: false
});

Dark Theme

// Dark theme notifications
toster.success('Dark theme success!', 'Success', { theme: 'dark' });
toster.error('Dark theme error!', 'Error', { theme: 'dark' });
toster.warning('Dark theme warning!', 'Warning', { theme: 'dark' });
toster.info('Dark theme info!', 'Info', { theme: 'dark' });

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please read our Development Guide for details on how to contribute.

Support

Author

Sanju - GitHub


Made with ❤️ for the web development community