JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q38096F
  • License MIT

A lightweight javascript toast library with no dependencies and 1 KB Size.

Package Exports

  • js-toastr

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (js-toastr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

js-toastr

A lightweight javascript toast library with no dependencies and 1 KB Size.

Demo

Install


# You can install js-toastr with npm
$ npm install --save js-toastr
 
# Alternatively you can use Yarn
$ yarn add js-toastr

CSS

//Copy or import css from toast.css or add through CDN Link

https://cdn.jsdelivr.net/npm/js-toastr@1.1.1/toast.css

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/js-toastr@1.1.1/toast.css">

JS


// using ES6 modules

import toastr from 'js-toastr';
 
// using CommonJS modules

var toastr = require('js-toastr');

// CDN Link

https://cdn.jsdelivr.net/npm/js-toastr@1.1.1/toast.min.js

<script src="https://cdn.jsdelivr.net/npm/js-toastr@1.1.1/toast.min.js"></script>

Set Message Postion (Optional)

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

Usage

// 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);

License

MIT