Minimal Toast & Snackbar JS Library – LiteNotifyJS

Category: Javascript , Notification | October 2, 2023
Author:jassriver
Views Total:49 views
Official Page:Go to website
Last Update:October 2, 2023
License:MIT

Preview:

Minimal Toast & Snackbar JS Library – LiteNotifyJS

Description:

LiteNotifyJS is a lightweight yet versatile JavaScript notification library to incorporate Material Design-inspired toast messages and snackbars into your webpage.

It supports various notification types such as Message, Alert, Error, and Confirm. For Confirm notifications, the library provides a callback function to trigger custom logic when the user confirms an action.

How to use it:

1. Download and import the LiteNotifyJS library.

<link rel="stylesheet" href="/dist/litenotify.css" />
<script src="/dist/litenotify.js"></script>

2. Create a basic toast message that slides from the bottom of the webpage.

litenotify({
  msg: "Toast Message Here",
});

3. Create an alert message that auto-dismisses after 10 seconds.

litenotify({
  msg: "An Alert Message",
  type: "alert",
  time: 5000,
});

4. Create an error message.

litenotify({
  msg: "An Error Message",
  type: "error",
});

5. Create a confirmation message.

litenotify({
  msg: "Do you want to redirect the page to CSSScript.Com?",
  type: "confirm",
  callback: () => {
    window.location = 'https://www.cssscript.com';
  },
});

You Might Be Interested In:


Leave a Reply