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

Category: Javascript , Modal & Popup , Notification | July 13, 2020
Author:khanmdsagar
Views Total:404 views
Official Page:Go to website
Last Update:July 13, 2020
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");

You Might Be Interested In:


Leave a Reply