AlertifyJS - Browser Dialogs & Notifications

1.14.0 · maintenance · verified Sun Apr 19

AlertifyJS is a lightweight JavaScript framework designed for creating customizable and visually appealing browser dialogs (alerts, confirms, prompts) and unobtrusive notification messages. Currently stable at version 1.14.0, the package was last updated approximately two years ago, suggesting an inactive release cadence. It aims to replace native browser dialogs, which are often blocking and visually inconsistent, with a more modern and user-friendly experience. Key differentiators include its small footprint, out-of-the-box theme support (AlertifyJS, Semantic UI, Bootstrap), responsiveness across devices, and built-in internationalization (i18n) and Right-to-Left (RTL) layout support. Unlike full-fledged UI libraries, AlertifyJS focuses solely on dialogs and notifications, offering a simple API for common use cases.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import AlertifyJS and its necessary CSS, then use its core functionalities: `alert`, `confirm`, `prompt`, and various `notifier` messages (success, error, warning, message). It includes callback examples for interactive dialogs.

import alertify from 'alertifyjs';
import 'alertifyjs/build/css/alertify.min.css';
import 'alertifyjs/build/css/themes/semantic.min.css'; // Or 'default.min.css', 'bootstrap.min.css'

// Basic Alert
alertify.alert('Hello World!', function(){ alertify.message('You clicked OK'); });

// Confirm Dialog
alertify.confirm('Confirm Action', 'Are you sure you want to proceed?',
  function(){
    alertify.success('You clicked OK');
  },
  function(){
    alertify.error('You clicked Cancel');
  }
);

// Prompt Dialog
alertify.prompt('Prompt Example', 'Please enter your name:', 'Anonymous',
  function(evt, value){
    alertify.success(`Hello ${value}!`);
  },
  function(){
    alertify.error('You clicked Cancel');
  }
);

// Notification Message
alertify.success('Success message here!');
alertify.error('Error message here!');
alertify.warning('Warning message here!');
alertify.message('Normal message here.');

console.log('AlertifyJS initialized and examples run.');

view raw JSON →