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

Category: Javascript , Modal & Popup | July 16, 2023
Views Total:199 views
Official Page:Go to website
Last Update:July 16, 2023


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


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 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.

  // 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'


v2.1.1 (07/16/2023)

  • Optional params.title

v2.1.0 (07/15/2023)

  • modal background color custom prop & showMarks option

v2.0.0 (06/17/2023)

  • Removed setDefaults func

You Might Be Interested In:

Leave a Reply