Minimal Alert, Confirm, And Toast Dialog In JavaScript – Asteroid Alert

Category: Javascript , Modal & Popup , Notification | March 11, 2021
Author:khanmdsagar
Views Total:1,332 views
Official Page:Go to website
Last Update:March 11, 2021
License:MIT

Preview:

Minimal Alert, Confirm, And Toast Dialog In JavaScript – Asteroid Alert

Description:

Asteroid Alert is a standalone JavaScript dialog popup library to create minimal, modern alert & confirm dialog boxes and toast-like notification popups using pure JavaScript.

How to use it:

1. Place the asteroid-alert library on your HTML page.

<script src="./asteroid-alert-min.js"></script>

2. Create an alert dialog using the $alert(text, buttonColor) method:

  • text: Alert message
  • buttonColor: Button color
$alert('CSSScript.Com', '#ff0000');

3. Create a confirmation dialog using the $confirm(text, buttonColor) method. This function also returns a promise which you can attach a callback when the user confirms the action.

$confirm("Do you want to delete?", "#E74C3C")
  .then(() => {
    // do something
})

4. Create an Android-like toast popup using the $toast(text, buttonColor) method:

$toast("Deleted", "#E74C3C");

5. Create an alert box.

$alert("Alert Message", '#E74C3C');

6. Create a loading indicator.

$loader_show("#FF5733");
$loader_hide();

Changelog:

03/11/2021

  • added loader

02/28/2021

  • Updated

You Might Be Interested In:


One thought on “Minimal Alert, Confirm, And Toast Dialog In JavaScript – Asteroid Alert

Leave a Reply