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

ziko-toaster

v1.2.9

Published

๐ŸŽ‰ Professional toast notification library with RTL support, animations, and zero dependencies

Readme

๐ŸŽ‰ Ziko Toaster

Professional toast notification library with zero dependencies, RTL support, smooth animations, and modern design.

npm version License: MIT Downloads

โœจ Features

  • ๐Ÿš€ Zero Dependencies - Pure vanilla JavaScript
  • ๐ŸŽจ Beautiful Design - Modern, clean UI with gradient backgrounds
  • ๐ŸŒ RTL Support - Perfect for Arabic, Hebrew, and other RTL languages
  • ๐Ÿ“ฑ Fully Responsive - Works great on all screen sizes
  • ๐ŸŽญ Multiple Animations - Slide, fade, bounce, zoom
  • โš™๏ธ Highly Customizable - Extensive options for every use case
  • ๐ŸŒ™ Dark Mode - Automatic dark theme support
  • ๐Ÿ“ฆ Tiny Size - Only ~8KB minified
  • โธ๏ธ Pause on Hover - Automatic pause when hovering
  • ๐ŸŽฏ Click to Close - Optional close on click

๐Ÿ“ฆ Installation

NPM

npm install ziko-toaster

CDN

<!-- Styling -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ziko-toaster@latest/dist/toast.min.css">
<!-- unpkg -->
<script src="https://unpkg.com/ziko-toaster@latest/dist/toast.min.js"></script>
<!-- jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/ziko-toaster@latest/dist/toast.min.js"></script>

๐Ÿš€ Quick Start

Basic Usage (English)

// Create instance
const toast = new AdvancedToast();

// Show notifications
toast.success('Operation completed successfully!');
toast.error('Something went wrong!');
toast.warning('Please be careful!');
toast.info('Here is some useful information');

RTL Support (Arabic/Hebrew)

// Create RTL instance
const toast = new AdvancedToast({ rtl: true });

// Show Arabic notifications
toast.success('ุชู…ุช ุงู„ุนู…ู„ูŠุฉ ุจู†ุฌุงุญ!');
toast.error('ุญุฏุซ ุฎุทุฃ ู…ุง!');
toast.warning('ูŠุฑุฌู‰ ุงู„ุงู†ุชุจุงู‡!');
toast.info('ู‡ุฐู‡ ู…ุนู„ูˆู…ุฉ ู…ููŠุฏุฉ');

HTML Usage (CDN)

<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <title>Ziko Toaster Example</title>
</head>
<body>
    <button onclick="showToast()">ุงุถุบุท ู‡ู†ุง</button>

    <!-- Include library -->
    <script src="https://unpkg.com/ziko-toaster@latest/dist/toast.min.js"></script>
    
    <script>
        // Initialize
        const toast = new AdvancedToast({ rtl: true });
        
        function showToast() {
            toast.success('ุชู… ุงู„ุญูุธ ุจู†ุฌุงุญ! ๐ŸŽ‰');
        }
    </script>
</body>
</html>

๐Ÿ“š API Documentation

Constructor Options

const toast = new AdvancedToast({
    type: 'info',              // Default toast type: 'success' | 'error' | 'warning' | 'info'
    title: '',                 // Default title (auto-generated based on type if empty)
    message: '',               // Default message
    duration: 3000,            // Duration in milliseconds (0 = no auto-close)
    position: 'top-right',     // Position on screen
    animation: 'slide',        // Animation type (fade - bounce - slide) upgrade
    showProgress: true,        // Show progress bar
    pauseOnHover: true,        // Pause timer on hover
    closeOnClick: false,       // Close toast when clicked
    showCloseButton: true,     // Show X close button
    rtl: false,                // Right-to-left mode (Arabic/Hebrew) upgrade
    customClass: '',           // Custom CSS class
    icon: null,                // Custom icon (HTML string or Font Awesome class)
    onClick: null,             // Click callback function(toastId)
    onClose: null              // Close callback function(toastId)
});

Methods

show(options) - Main Method

Display a toast with custom options.

const toastId = toast.show({
    type: 'success',
    title: 'Custom Title',
    message: 'Your custom message here',
    duration: 5000,
    position: 'bottom-center',
    animation: 'bounce'
});

Shortcut Methods

Quick methods for common toast types:

// Success toast
const id1 = toast.success('Operation successful!', {
    title: 'Done!',
    duration: 4000
});

// Error toast
const id2 = toast.error('Something went wrong!', {
    title: 'Error',
    duration: 5000
});

// Warning toast
const id3 = toast.warning('Please check your input', {
    title: 'Warning'
});

// Info toast
const id4 = toast.info('New update available', {
    title: 'Information'
});

Control Methods

// Close specific toast by ID
const id = toast.info('Processing...');
toast.close(id);

// Close all active toasts
toast.closeAll();

// Pause specific toast
toast.pause(id);

// Resume specific toast
toast.resume(id);

// Update default options
toast.setDefaults({
    position: 'bottom-right',
    duration: 4000,
    rtl: true
});

// Destroy toast system (cleanup)
toast.destroy();

โš™๏ธ Configuration Options

All Available Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | type | string | 'info' | Toast type: 'success', 'error', 'warning', 'info' | | title | string | Auto | Toast title (auto-generated if empty) | | message | string | '' | Toast message content | | duration | number | 3000 | Duration in ms (0 = persistent, won't auto-close) | | position | string | 'top-right' | Position: 'top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left', 'bottom-center' | | animation | string | 'slide' | Animation: 'slide', 'fade', 'bounce', 'zoom' | | showProgress | boolean | true | Show animated progress bar | | pauseOnHover | boolean | true | Pause countdown on mouse hover | | closeOnClick | boolean | false | Close toast when clicked anywhere | | showCloseButton | boolean | true | Show X close button | | rtl | boolean | false | Right-to-left text direction | | customClass | string | '' | Additional CSS class for styling | | icon | string\|null | null | Custom icon (HTML or FontAwesome class) | | onClick | function\|null | null | Callback when toast is clicked: (toastId) => {} | | onClose | function\|null | null | Callback when toast closes: (toastId) => {} |

Position Options

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  top-left    top-center  top-right  โ”‚
โ”‚                                 โ”‚
โ”‚                                 โ”‚
โ”‚                                 โ”‚
โ”‚ bottom-left bottom-center bottom-right โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Default Titles

English (rtl: false)

  • Success: "Success"
  • Error: "Error"
  • Warning: "Warning"
  • Info: "Info"

Arabic (rtl: true)

  • Success: "ู†ุฌุงุญ"
  • Error: "ุฎุทุฃ"
  • Warning: "ุชุญุฐูŠุฑ"
  • Info: "ู…ุนู„ูˆู…ุฉ"

๐ŸŽจ Usage Examples

Example 1: Simple Success Message

const toast = new AdvancedToast();
toast.success('Data saved successfully!');

Example 2: Custom Position & Duration

toast.error('Connection failed!', {
    position: 'bottom-center',
    duration: 5000
});

Example 3: With Custom Title

toast.info('You have 5 new messages', {
    title: 'Notifications',
    duration: 4000
});

Example 4: Custom Icon (FontAwesome)

Make sure you have FontAwesome loaded:

toast.success('Profile updated', {
    icon: 'fas fa-user-check',
    title: 'Account'
});

Example 5: Custom Icon (Emoji/HTML)

toast.info('New features available!', {
    icon: '๐Ÿš€',
    title: 'Update'
});

Example 6: Click to Close

toast.warning('Click me to dismiss', {
    closeOnClick: true,
    duration: 0  // Won't auto-close
});

Example 7: With Callbacks

const id = toast.success('File uploaded successfully', {
    onClick: (toastId) => {
        console.log('Toast clicked:', toastId);
        window.open('/files');
    },
    onClose: (toastId) => {
        console.log('Toast closed:', toastId);
        // Trigger next action
    }
});

Example 8: Persistent Toast (Manual Close)

// Show processing toast
const processingId = toast.info('Processing your request...', {
    duration: 0,  // Won't auto-close
    showProgress: false,
    showCloseButton: false
});

// Simulate API call
fetch('/api/data')
    .then(response => {
        toast.close(processingId);
        toast.success('Request completed!');
    })
    .catch(error => {
        toast.close(processingId);
        toast.error('Request failed!');
    });

Example 9: Form Validation

function validateForm() {
    const email = document.getElementById('email').value;
    const password = document.getElementById('password').value;
    
    if (!email) {
        toast.error('Email is required', {
            title: 'Validation Error',
            position: 'top-center'
        });
        return false;
    }
    
    if (password.length < 6) {
        toast.warning('Password must be at least 6 characters', {
            title: 'Weak Password',
            duration: 5000
        });
        return false;
    }
    
    toast.success('Form is valid!', {
        title: 'Success'
    });
    return true;
}

Example 10: Shopping Cart

function addToCart(product) {
    // Add product logic...
    
    toast.success(`"${product.name}" added to cart`, {
        title: 'Cart Updated',
        icon: '๐Ÿ›’',
        position: 'bottom-right',
        duration: 2000,
        onClick: () => {
            window.location.href = '/cart';
        }
    });
}

Example 11: Arabic/RTL Support

const toastAr = new AdvancedToast({ rtl: true });

// Login success
toastAr.success('ุชู… ุชุณุฌูŠู„ ุงู„ุฏุฎูˆู„ ุจู†ุฌุงุญ', {
    title: 'ุฃู‡ู„ุงู‹ ุจูƒ',
    icon: '๐Ÿ‘‹',
    duration: 3000
});

// Error message
toastAr.error('ูุดู„ ุงู„ุงุชุตุงู„ ุจุงู„ุฎุงุฏู…', {
    title: 'ุฎุทุฃ',
    duration: 5000
});

Example 12: Different Animations

// Slide animation (default)
toast.success('Slide animation', { animation: 'slide' });

// Fade animation
toast.info('Fade animation', { animation: 'fade' });

// Bounce animation
toast.warning('Bounce animation', { animation: 'bounce' });

// Zoom animation
toast.error('Zoom animation', { animation: 'zoom' });

Example 13: Set Global Defaults

// Set once for all toasts
toast.setDefaults({
    position: 'bottom-right',
    duration: 4000,
    animation: 'bounce',
    showProgress: true
});

// All subsequent toasts will use these defaults
toast.success('Using default settings');
toast.error('Also using default settings');

Example 14: Multiple Toast Instances

// English toasts (top-right)
const toastEn = new AdvancedToast({
    position: 'top-right',
    rtl: false
});

// Arabic toasts (top-left)
const toastAr = new AdvancedToast({
    position: 'top-left',
    rtl: true
});

toastEn.success('Operation successful!');
toastAr.success('ุชู…ุช ุงู„ุนู…ู„ูŠุฉ ุจู†ุฌุงุญ!');

๐ŸŽญ Animation Types

  • slide - Smooth slide from the side (default)
  • fade - Fade in/out with scale
  • bounce - Bouncy entrance from top
  • zoom - Scale in/out from center

๐ŸŒ Framework Integration

React Example

import { useEffect, useRef } from 'react';
import AdvancedToast from 'ziko-toaster';

function App() {
    const toastRef = useRef(null);

    useEffect(() => {
        toastRef.current = new AdvancedToast({ rtl: true });
        
        return () => {
            toastRef.current?.destroy();
        };
    }, []);

    const handleSave = () => {
        toastRef.current?.success('ุชู… ุงู„ุญูุธ ุจู†ุฌุงุญ!');
    };

    return (
        <button onClick={handleSave}>Save</button>
    );
}

Vue Example

<template>
    <button @click="showToast">Show Toast</button>
</template>

<script>
import AdvancedToast from 'ziko-toaster';

export default {
    data() {
        return {
            toast: null
        };
    },
    mounted() {
        this.toast = new AdvancedToast({ rtl: true });
    },
    methods: {
        showToast() {
            this.toast.success('ุชู…ุช ุงู„ุนู…ู„ูŠุฉ ุจู†ุฌุงุญ!');
        }
    },
    beforeUnmount() {
        this.toast?.destroy();
    }
};
</script>

๐ŸŒ Browser Support

  • โœ… Chrome (last 2 versions)
  • โœ… Firefox (last 2 versions)
  • โœ… Safari (last 2 versions)
  • โœ… Edge (last 2 versions)
  • โœ… Opera (last 2 versions)
  • โœ… Mobile browsers (iOS Safari, Chrome Mobile)

๐Ÿ› Troubleshooting

Toast not showing?

window.addEventListener('DOMContentLoaded', () => {
    const toast = new AdvancedToast();

    window.showToast = function() {
        toast.warning('ุชู… ุงู„ุญูุธ ุจู†ุฌุงุญ! ๐ŸŽ‰');
    }
});  // โœ“ Correct
// Not this:
AdvancedToast.success('test'); // โœ— Wrong

RTL not working?

// Make sure rtl is set in constructor or options
const toast = new AdvancedToast({ rtl: true }); // โœ“ Global

// Or per toast
toast.success('ู…ุฑุญุจุง', { rtl: true }); // โœ“ Per toast

๐Ÿ“ License

MIT ยฉ Ziad Mahmoud

๐Ÿค Contributing

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ง Support

โญ Show Your Support

Give a โญ๏ธ if this project helped you!


Made with โค๏ธ by Ziad Mahmoud