Customizable Alert/Confirm Modal Library – modal-alert.js

Category: Javascript , Modal & Popup | February 27, 2023
Author:massimo-cassandro
Views Total:146 views
Official Page:Go to website
Last Update:February 27, 2023
License:MIT

Preview:

Customizable Alert/Confirm Modal Library – modal-alert.js

Description:

Just another alternative to the native JavaScript popup boxes.

modal-alert.js is a lightweight Vanilla JavaScript library to create alert & confirmation modal windows with customizable content and buttons.

How to use it:

1. Install and download.

# NPM
$ npm i @massimo-cassandro/modal-alert

2. Import the modal-alert.js.

import mAlert from '@massimo-cassandro/modal-alert';

3. Create alert and confirm modal windows using the mAlert method.

mAlert({
  // success, warning, error, info, or confirm
  type: 'success',
  
  // modal title
  title: 'my title', 
  // message
  mes: 'Some message', 
  // OK button
  ok_btn_text: 'OK',
  // `confirm` only
  cancel_btn_text: 'Cancel',
  // callback function
  callback : function(result) {}, 
  // auto dismiss after 4000
  // default `4000` for success, `null` for the others
  timer: 4000,
  // default CSS classes
  heading_class: 'text-success',
  ok_btn_class: 'btn-success',
  cancel_btn_class: 'btn-outline-warning'
  
});

You Might Be Interested In:


Leave a Reply