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

toastthk

v1.0.11

Published

A customizable toast notification library

Readme

Toast Notification

A customizable toast notification library for displaying messages with different styles and durations.

Table of Contents

Installation

You can install the package via npm:

npm install toastthk

Usage

After installing, you can use the toast notification by including the required JavaScript and CSS files:

<!-- Include CSS -->
<link rel="stylesheet" href="path/to/toast.css">
<!-- Include JS -->
<script src="path/to/toast.js"></script>
/* Import css */
@import 'toastthk/toast.css'
// import js
import 'toastthk'

Then you can show a toast by calling the Toast.show() function:

// Display a default toast message
Toast.show('This is a default toast');

// Display a success toast message
Toast.show('Success message', { type: 'success' });
Toast.success('Success message');

// Display an danger toast message with a custom icon
Toast.show('Danger message', { type: 'danger', icon: 'fas fa-bug' });
Toast.danger('Success message', { icon: 'fas fa-bug' });

// Display a custom toast with an icon and different position
Toast.show('Custom Icon Toast', { icon: 'fas fa-smile', position: 'bottom-left' });

Options

You can customize the toast notification by passing options as the second argument to Toast.show(). The available options are:

| Option | Type | Default | Description | |----------------|-----------------------------|---------------|-------------------------------------------------| | type | string | 'default' | Type of toast (affects color and icon). | | position | string | 'top-right' | Position of the toast on screen. | | duration | number | 300 | Animation duration in milliseconds. | | delay | number | 3000 | How long the toast stays visible (ms). | | hideProgress | boolean | false | Whether to hide the progress bar. | | closeOnClick | boolean | true | Whether clicking the toast closes it. | | icon | string, null | null | Custom icon class name to display. | | hideIcon | boolean | false | Whether to hide the default icon. | | outLine | boolean | false | Set background to white. |

  • type: The type of the toast (default, success, danger, warning, info). Default is 'default'.
  • position: The position of the toast on the screen (top-left, top-right, bottom-left, bottom-right). Default is 'top-right'.
  • hideProgress: Whether to hide the progress bar (true or false). Default is false.
  • delay: The delay before the toast disappears (in milliseconds). Default is 3000.
  • closeOnClick: Whether the toast can be closed by clicking on it (true or false). Default is true.
  • duration: The duration of the toast animation (in milliseconds). Default is 300.
  • icon: A custom icon for the toast. If not provided, a default icon will be used based on the type.
  • hideIcon: Whether to hide the icon (true or false). Default is false.
  • outLine: Set background to white (true or false). Default is false.

Example with options

Toast.show('Custom success message', { 
  type: 'success', 
  position: 'bottom-left', 
  delay: 5000, 
  icon: 'fas fa-check-circle' 
});

Customizing the Styles

You can customize the CSS styles to fit your project needs. The package comes with default styles, but you can modify the following classes:

  • .toastthk-wrapper: The container for all toast messages.
  • .toastthk-container: The container for a single toast message.
  • .toastthk-item: The individual toast item.
  • .toastthk-progress: The progress bar inside the toast.

Feel free to override the styles in your own CSS file to better suit your needs.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Buy Me a Coffee

This toast notification library was crafted with care and countless cups of coffee ☕.
If you find it useful or it saved you time in your project, consider supporting me so I can keep building and maintaining cool open-source tools like this.

Your support fuels more late-night coding sessions, feature improvements, and bug fixes ❤️