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

@tsirosgeorge/toastnotification

v5.3.3

Published

a toast notification plugin

Readme

🔔 ToastNotification

A lightweight, customizable, and dependency-free toast notification system written in vanilla JavaScript.

License: Proprietary - See LICENSE file. This is NOT open source software.


📦 Include package via cdn

<script src="https://cdn.jsdelivr.net/npm/@tsirosgeorge/[email protected]/toast.min.js"></script>

📦 Include package via npm

npm i @tsirosgeorge/toastnotification

💡 Usage instructions

🔹 Basic Toast

toast('Hello world!');

🔸 With Options

toast('Data saved successfully!', {
  type: 'success',
  position: 'top-left',
  duration: 5000,
  animation: 'slide-right',
  icon: '✅',
  showLoader: true,
  onClick: () => alert('Toast clicked!'),
  onShow: () => console.log('Toast shown'),
  onDismiss: () => console.log('Toast dismissed')
});

✅ Convenience helpers

toast.success('Saved!');
toast.error('Failed!');

⚠️ Confirm (SweetAlert-like)

  • Promise API
const ok = await toast.confirm('This will delete the file.', {
  title: 'Are you sure?',
  type: 'warning',
  confirmText: 'Yes, delete',
  cancelText: 'Cancel',
  useOverlay: true,
  closeOnOverlayClick: true,
  showClose: true,
  // optional custom button colors
  confirmButtonBg: '#10b981',
  confirmButtonColor: '#fff',
  cancelButtonBg: '#e5e7eb',
  cancelButtonColor: '#1f2937',
});
if (ok) {
  // proceed
}
  • With Input Field
const name = await toast.confirm('Enter your name:', {
  title: 'Welcome',
  input: 'text',  // 'text', 'email', 'password', 'number', 'textarea'
  inputPlaceholder: 'Your name here...',
  inputValue: '',  // optional default value
  confirmText: 'Submit',
  cancelText: 'Cancel',
});
if (name) {
  console.log('Hello', name);
} else {
  console.log('Cancelled');
}
  • Callback API
toast('Are you sure?', {
  mode: 'confirm',
  type: 'warning',
  title: 'Confirm action',
  onConfirm: () => console.log('YES'),
  onCancel: () => console.log('NO'),
});

⏳ Loading → Update

const t = toast.loading('Uploading…', { type: 'info' });
// later
t.update('Done!', { type: 'success', duration: 2000 });

🛠️ Available Options

| Option | Type | Default | Description | |--------------|------------|---------------|-----------------------------------------------------------------------------------------------| | position | string | 'top-right' | Container position. Values: 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'top-center', 'bottom-center'. | | animation | string | 'slide-right' | Show animation. Examples: 'slide-right', 'slide-left', 'slide-top', 'slide-bottom', 'zoom-in'. Hide uses reverse automatically. | | type | string | 'info' | Type of toast, controlling icon and styling. Possible values: 'info', 'success', 'error', 'warning'. | | duration | number | 3000 | Duration in milliseconds before the toast automatically dismisses. | | icon | string or null | null | Optional custom icon displayed as text (e.g., emoji) before the toast message. If not set, a default GIF icon is used based on the type. | | showLoader | boolean | false | Whether to show a loader/progress bar animation on the toast during its visible duration. | | onClick | function or null | null | Callback function executed when the toast is clicked. | | onShow | function or null | null | Callback function executed when the toast appears (after it's added to the DOM and shown). | | onDismiss | function or null | null | Callback function executed when the toast is dismissed and removed from the DOM. |

🧩 Confirm-specific options

| Option | Type | Default | Description | |-------|------|---------|-------------| | mode | "confirm" \| "swal" | — | Set to show a confirm dialog with Yes/No buttons. | | title | string | null | Optional heading shown above the message. | | confirmText | string | "Yes" | Confirm button label. | | cancelText | string | "No" | Cancel button label. | | input | string \| false | false | Input field type: 'text', 'email', 'password', 'number', 'textarea', or false for no input. | | inputPlaceholder | string | "" | Placeholder text for the input field. | | inputValue | string | "" | Default value for the input field. | | useOverlay | boolean | true | Dim the background and center the dialog. | | closeOnOverlayClick | boolean | true | Clicking the overlay cancels. | | showClose | boolean | false | Show a top-right × button. | | confirmButtonBg | string | null | Inline background color for confirm button. | | confirmButtonColor | string | null | Inline text color for confirm button. | | cancelButtonBg | string | null | Inline background color for cancel button. | | cancelButtonColor | string | null | Inline text color for cancel button. |

🧪 Live Demo

Open the online demo to try all options: https://tsirosgeorge.github.io/toast-notification/


📝 License

© 2025 George Tsiros. All rights reserved.

This software is provided for use only as distributed by the author.

❌ Restrictions

  • Modifying or creating derivative works is not allowed.
  • Redistributing, sublicensing, or reselling the software is prohibited.
  • Reverse engineering or extracting the source code is strictly forbidden.

⚠️ Disclaimer

This software is provided "as is", without warranty of any kind. Use at your own risk.

📬 For commercial licensing or inquiries, please contact the author at: [email protected]


Note: See the LICENSE file included in this package for full terms and conditions.