A lightweight javascript toast library with no dependencies and 1 KB Size.
# You can install js-toastr with npm
$ npm install --save js-toastr
# Alternatively you can use Yarn
$ yarn add js-toastr
//Copy or import css from toast.css or add through CDN Link
https://cdn.jsdelivr.net/npm/[email protected]/toast.css
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/toast.css">
// using ES6 modules
import toastr from 'js-toastr';
// using CommonJS modules
var toastr = require('js-toastr');
// CDN Link
https://cdn.jsdelivr.net/npm/[email protected]/toast.min.js
<script src="https://cdn.jsdelivr.net/npm/[email protected]/toast.min.js"></script>
toastr.setPosition('top-right');
Position Options -
1. top-center
2. bottom-center
3. top-left
4. bottom-left
5. top-right
6. bottom-right
// Default Position if not set ==> top-right
// toastr.message(YOUR_MESSAGE, STATE, TIME_IN_Millisecond);
Example :
toastr.message('Welocome to tiny toast library', 'success', 3000);
toastr.message('Welocome to tiny toast library', 'error', 3000);
toastr.message('Welocome to tiny toast library', 'info', 3000);
toastr.message('Welocome to tiny toast library', 'warning', 3000);