banjo / toastler

🍞 Tiny (<15kb), super simple, dependency free toast notifications written with TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🍞 toastler

A lightweight and simple toast notification library for the browser.

toast example

NPM version

  • 🌴 - Three-shakable ESM modules.
  • πŸ’¬ - Fully typed TSDocs with examples
  • ⭐ - No dependencies
  • πŸ“ - Super lightweight (<15kb)
  • πŸŽ₯ - Simple animations
  • βœ… - Simple API and usage
  • βš™οΈ - Customizable with nice defaults
  • πŸ”΅ - Written in TypeScript

Mostly used in basic JavaScript/TypeScript projects where you want a simple toast/snackbar without having external dependencies or a large third-party library.

Usage

// import using ESM or CJS
import { toast } from "toastler";
const { toast } = require("toastler");

// Simple defaults
toast("Hello world");

// Highly customizable
toast("Hello world", { 
    duration: 10000, 
    type: "error", 
    animationTiming: 500, 
    fontSize: "1.5rem"
    //... 
    });

// Simple to remove
const { hide } = toast("Hello world");
hide();

// New toasts will remove old ones
toast("First toast");
setTimeout(() => {
    // This toast will hide the first toast before it is showed
    toast("Second toast");
}, 2000)

About

🍞 Tiny (<15kb), super simple, dependency free toast notifications written with TypeScript


Languages

Language:TypeScript 98.9%Language:Shell 1.1%