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

@faulkj/toaster

v2.1.4

Published

A highly customizable vanilla JavaScript library used to cleanly serve toast notifications.

Downloads

8

Readme

@faulkj/toaster

Toaster is a dependency-free, TypeScript-native toast notification library for modern web apps. Fast, minimal, fully customizable, and easy to drop into any frontend project.


Features

  • Zero dependencies: Lightweight, vanilla JS/TS - no external libraries required.
  • 🔷 TypeScript-native: Fully typed for safety and autocomplete.
  • 🎨 SCSS-based styles: Import or customize easily to match your app.
  • 🚀 Smooth transitions: Hardware-accelerated CSS animation for snappy feels.
  • 🔁 Auto queueing: Toasts display one at a time, in order.
  • 🧩 Highly customizable: Control timeout, class, animation duration, anchor, icon, and click behavior.
  • 🖱️ Clickable toasts: Add a click callback - toast dismisses after your code runs.
  • ⏸️ Persistent/sticky toasts: Set timeout: null for toasts that stay until dismissed.
  • 🏷️ Lifecycle events: Hook into all toast transitions (bake, baked, served, eat, eaten).
  • 🎭 Easy theming & positioning: Style and position toasts any way you want via CSS.

Installation

npm install @faulkj/toaster

Import the SCSS (Required for Styling)

@import "~@faulkj/toaster/src/scss/toaster.scss";

or

import "@faulkj/toaster/src/scss/toaster.scss";

CDN

<link rel="stylesheet" href="https://unpkg.com/@faulkj/toaster/dist/css/toaster.min.css">
<script src="https://unpkg.com/@faulkj/toaster/dist/js/toaster.min.js"></script>
<script>
  new Toaster("Plain JS toast!")

  new Toaster("Sticky, clickable!", {
    timeout: null,
    click: () => alert("Toast clicked!")
  })
</script>

Basic Usage (ESM/TypeScript)

import Toaster from "@faulkj/toaster"
// (SCSS must be imported in your global styles)

new Toaster("Hello, World!") // Bottom right by default

Options

All options are optional. Defaults are shown in comments.

  • timeout number | null – ms before dismissal (default: 2500)null = stays until dismissed.
  • class string – Any additional CSS classes
  • duration number – Animation duration in ms (default: 1000)
  • anchor "bottom" | "top" – Stack from bottom or top (default: "bottom")
  • icon string | null – Icon class for <i> (e.g. "bi bi-info-circle-fill")
  • click ((e: MouseEvent) => void) | null – Click handler (dismisses the toast)

Events

All toast instances emit:

  • bake – Toast created and added to the queue
  • baked – Toast added to the DOM, ready for animation
  • served – Display animation started
  • eat – Hide animation completed
  • eaten – Removed from DOM

Example:

const toast = new Toaster("Watch me!")
toast.el.addEventListener("eaten", () => {
  // Toast removed from DOM
})

Methods

  • eat() - Instantly dismisses the toast

Persistent / Clickable Toast

Set timeout: null to keep a toast until user dismisses it (by click or code):

new Toaster("Click to acknowledge.", {
  timeout: null,
  icon: "fa fa-bolt",
  click: () => alert("You clicked the toast!")
})
// Clicking dismisses the toast after callback execution.

Queueing

Toasts stack in the order that they are created.


Positioning

  • Use the anchor option ("top" or "bottom") to control vertical stacking.
  • Horizontal position (left, right, center) and stack direction are fully controlled by your CSS.
  • Example for top-right:
    .toaster {
      top: 0;
      right: 0;
      left: auto;
      bottom: auto;
    }

Custom Styling

Add a custom class for full theme control:

new Toaster("Dark mode", { class: "toast-dark" })
toaster.toast-dark {
  background: #222;
  color: #eee;
}