Skip to content

w99910/vanilla-toaster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanilla Toaster

Toast messages globally anywhere inside your app with a single static method.

AnimeJs is used for handling animation.

Installation

Import via NPM.

npm install vanilla-toaster

Or import from CDN https://cdn.jsdelivr.net/npm/vanilla-toaster@latest/dist/vanilla-toaster.js.

import Toaster from 'https://cdn.jsdelivr.net/npm/vanilla-toaster@latest/dist/vanilla-toaster.js';

Usage

Initialization

import Toaster from 'vanilla-toaster';

const toaster = document.createElement('div');
document.body.appendChild(toaster);
new Toaster(toaster);

Toast anywhere

import Toaster from 'vanilla-toaster';

Toaster.toast('Hello World!');

Customizing

  • Select toast type - info, success, warning, error.
Toaster.toast('Hello World!', 'success');
  • Provide Toast Duration in milliseconds. Default is 2000. (2 seconds)
Toaster.toast('Hello World!', 'success', 5000);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published