Toast messages globally anywhere inside your app with a single static method.
AnimeJs is used for handling animation.
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';
import Toaster from 'vanilla-toaster';
const toaster = document.createElement('div');
document.body.appendChild(toaster);
new Toaster(toaster);
import Toaster from 'vanilla-toaster';
Toaster.toast('Hello World!');
- 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);