willjouo / toastinette

An ultra-lightweight (< 1KB) notification library with no dependencies.

Home Page:https://willjouo.github.io/toastinette/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Toastinette

The challenge was to create a notification library under 1 KB.

Toastinette is an ultra-lightweight (minified CSS + JS <= 1 KB) notification library with no dependencies. It does not accept user input and there is no progress bar.

Size

File Size (bytes)
toastinette.min.js 696 B
toastinette.min.css 328 B
Total 1024 B

Installation

📦 npm

npm i --save toastinette

🖐️ Manual

In the <head> section:

<link rel="stylesheet" type="text/css" href="dist/toastinette.min.css">

At the bottom of the <body>:

<script src="dist/toastinette.min.js"></script>

Usage

Toastinette.show(type, duration, html);

Creates a new toast.

  • type: Either 'success', 'info', 'warning' or 'error'
  • duration: Show duration in ms
  • html: HTML code of the toast
Toastinette.setPosition(position, margin = 12);

Set the position of the toasts.

  • position: 'tl' for top left, 'tr' for top right, 'br' for bottom right (default) or 'bl' for bottom left
  • margin: Optional. The margin in px. Default is 12px.

About

An ultra-lightweight (< 1KB) notification library with no dependencies.

https://willjouo.github.io/toastinette/

License:MIT License


Languages

Language:JavaScript 88.0%Language:CSS 12.0%