DEV Community

Mitesh Kamat
Mitesh Kamat

Posted on

Library for modals, dialogs and alerts

Introduction

This post is about a ui library for modal popup.

Every now and then for a requirement involving modal popups, alert or prompts we tend to go for bootstrap as it also gives us grid layouts, utilities and handful of components to leverage.

It was not different in my case. But then, I stumbled upon a library name jQuery-confirm which had unique use cases. So, I decided to make use of this library.

My minimum usecases were:

It should be customizable from UI standpoint

It doesnot disappoint as you get:

  1. nice style options, drag feature, color options.
  2. theme options like light,dark, modern, material,etc.
  3. animation support
  4. auto close feature

It should have something for AJAX requests

With jconfirm you have the power to load content directly when needed via ajax, no extra code.
Two methods are available to load content via Ajax:

  1. Pass in String content the URL with "URL:" prepended. content: "URL:http://example.com/getData?id=1"
  2. Pass in Function that returns a jQuery ajax promise. content: function(){ return $.get(...); }

Lastly proper documentation with examples

Do give it a try as it happens to be a nice alternative with cool features.

Cheers !!!

Discussion (0)