Giter VIP home page Giter VIP logo

basicmodal's Introduction

basicModal

Easy-to-use dialog system for modern web-apps.

Modal Screenshot

basicModal is a dialog-system for modern web-apps. It includes everything you need to display information, ask questions or request input from the user. Dialogs can be chained, so you can easily build a setup-assistant or show messages in a predefined order. Invalid input can be highlighted and handled using the included function.

basicModal is written in Vanilla JS and has zero dependencies. It uses SASS and Flexbox.

Tested with the latest versions of Mozilla Firefox, Apple Safari, Google Chrome, Microsoft Internet Explorer (10+) and Opera.

Demos

Name Description Link
Alert Modal similar to alert(). The modal contains a message and a button. The message can be filled with HTML and the button fires the specified function when pressed. Demo
Prompt The prompt dialog is great when you want a decision or answer from the user. Demo
Login Building a login with basicModal is super easy. It includes everything you need, like the ability to highlight invalid input. Demo

Features

  • Works in all modern browsers
  • Zero dependencies
  • Support for text inputs
  • Highlight invalid input
  • Execute dialogs in row

Installation

We recommend to install basicModal using Bower or npm.

bower install basicModal
npm install basicmodal

Requirements

basicModal dependents on the following browser APIs:

Some of these APIs are capable of being polyfilled in older browser. Check the linked resources above to determine if you must polyfill to achieve your desired level of browser support.

Include

Include the CSS file in the head and the JS file at the end of your body.

<link rel="stylesheet" href="dist/basicModal.min.css">
<script src="dist/basicModal.min.js"></script>

Functions

You can find a list of available functions on our site.

Options

List of options you can pass to the basicModal.show-function:

{
	body: '<p>String containing HTML</p>',
	class: 'customClass01 customClass02',
	closable: true,
	callback: undefined,
	buttons: {
		cancel: {
			title: 'Cancel',
			class: 'customButtonClass',
			fn: function(data) { console.log(data) }
		},
		action: {
			title: 'OK',
			class: 'customButtonClass',
			fn: function(data) { console.log(data) }
		}
	}
}
Option Type Default Required
body String "" No
class String "" No
closable boolean true No
callback Function undefined No
buttons Object undefined Yes

basicModal accepts up to two buttons: cancel and action. Both of them can have the following options:

Option Type Default Required
title String "Cancel" or "OK" No
class String "" No
fn Function undefined Yes

basicmodal's People

Contributors

electerious avatar

Watchers

Yashi Lanka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.