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 🙏

© 2025 – Pkg Stats / Ryan Hefner

multi-position-toaster

v1.0.9

Published

A powerful toast notification library with 9 positioning options, themes, and smooth animations

Downloads

659

Readme

🍞 Multi-Position Toaster

A powerful, customizable toast notification library with 9 positioning options, smooth animations, and complete theme control.

Live Demo | Documentation | Examples

npm version bundle size license

✨ Features

  • 🎯 9 Position Options - Display toasts anywhere on screen
  • Smooth Animations - Slide, fade, or bounce with 60fps performance
  • 🎨 Theme Support - Light, dark, and custom themes
  • 📱 Fully Responsive - Perfect mobile experience
  • 🔧 TypeScript Support - Full type definitions included
  • 🚀 Lightweight - Under 8KB gzipped, zero dependencies
  • Accessible - ARIA labels and keyboard support
  • 🎛️ Highly Customizable - Configure every aspect

📦 Installation

npm install multi-position-toaster

Or use via CDN:

<script src="https://unpkg.com/multi-position-toaster/dist/toaster.min.js"></script>

🚀 Quick Start

import { success, error, topLeft, center } from 'multi-position-toaster';

// Simple usage
success('Operation completed!');
error('Something went wrong!');

// Position-specific
topLeft('Hello from top-left!');
center('Centered message!');

📍 All Available Positions

import { 
  topLeft, topCenter, topRight,
  centerLeft, center, centerRight,
  bottomLeft, bottomCenter, bottomRight 
} from 'multi-position-toaster';

topLeft('Top Left');
topCenter('Top Center');
topRight('Top Right');
centerLeft('Center Left');
center('Center');
centerRight('Center Right');
bottomLeft('Bottom Left');
bottomCenter('Bottom Center');
bottomRight('Bottom Right');

🎨 Advanced Usage

Custom Configuration

import { create } from 'multi-position-toaster';

const toaster = create({
  position: 'top-center',
  theme: 'dark',
  animation: 'bounce',
  maxToasts: 3,
  defaultDuration: 4000,
  pauseOnHover: true
});

toaster.success('Custom configured toast!');

Rich Options

import { show } from 'multi-position-toaster';

show({
  type: 'warning',
  title: 'Warning',
  message: 'This action cannot be undone',
  position: 'center',
  duration: 10000,
  animation: 'bounce',
  pauseOnHover: true,
  progressBar: true,
  onClick: (toast) => {
    console.log('Toast clicked!');
  },
  onClose: (toast) => {
    console.log('Toast closed!');
  }
});

📖 API Reference

Methods

Type-Specific Methods

  • success(message, options?) - Show success toast
  • error(message, options?) - Show error toast
  • warning(message, options?) - Show warning toast
  • info(message, options?) - Show info toast

Position Methods

  • topLeft(message, options?)
  • topCenter(message, options?)
  • topRight(message, options?)
  • centerLeft(message, options?)
  • center(message, options?)
  • centerRight(message, options?)
  • bottomLeft(message, options?)
  • bottomCenter(message, options?)
  • bottomRight(message, options?)

Utility Methods

  • show(options) - Show toast with full configuration
  • clear(position?) - Clear toasts (all or by position)
  • setDefaults(options) - Set global defaults
  • setTheme(theme) - Change theme dynamically
  • create(options) - Create new toaster instance

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | position | string | 'top-right' | Toast position on screen | | theme | string | 'light' | Theme: 'light' or 'dark' | | maxToasts | number | 5 | Max toasts per position | | defaultDuration | number | 5000 | Default duration in ms | | animation | string | 'slide' | Animation type | | stackDirection | string | 'down' | Stack direction: 'up' or 'down' | | pauseOnHover | boolean | true | Pause on hover | | progressBar | boolean | true | Show progress bar |

Toast Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | type | string | 'info' | 'success', 'error', 'warning', 'info' | | title | string | '' | Toast title | | message | string | '' | Toast message (required) | | duration | number | 5000 | Duration in ms (0 = no auto-dismiss) | | position | string | - | Override default position | | closable | boolean | true | Show close button | | onClick | function | null | Click callback | | onClose | function | null | Close callback |

🎯 Use Cases

E-commerce

import { topRight, bottomCenter } from 'multi-position-toaster';

// Cart updates
topRight('Item added to cart!', { type: 'success' });

// Checkout
bottomCenter('Processing payment...', { type: 'info', duration: 0 });

Form Validation

import { topCenter } from 'multi-position-toaster';

topCenter('Please enter a valid email', { 
  type: 'error',
  duration: 4000 
});

Real-time Notifications

import { create } from 'multi-position-toaster';

const notifier = create({
  position: 'bottom-left',
  theme: 'dark',
  maxToasts: 3
});

// WebSocket messages
socket.on('message', (data) => {
  notifier.info(data.text);
});

🌐 Browser Support

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

📄 License

MIT © Kunal Risaanva

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📧 Support


Made with ❤️ for developers who care about UX