https://github.com/mttbernardini/dialog
ℹ️ A simple JS library for minimal dialog boxes on webpages.
https://github.com/mttbernardini/dialog
alert customizable dialog dialog-boxes library modal-dialogs prompt
Last synced: 26 days ago
JSON representation
ℹ️ A simple JS library for minimal dialog boxes on webpages.
- Host: GitHub
- URL: https://github.com/mttbernardini/dialog
- Owner: mttbernardini
- License: mit
- Created: 2015-09-23T10:33:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-12T19:55:51.000Z (about 4 years ago)
- Last Synced: 2025-02-13T14:26:06.039Z (3 months ago)
- Topics: alert, customizable, dialog, dialog-boxes, library, modal-dialogs, prompt
- Language: JavaScript
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# dialog.js #
[](https://www.codacy.com/app/mttbernardini/dialog?utm_source=github.com&utm_medium=referral&utm_content=mttbernardini/dialog&utm_campaign=Badge_Grade)
This project is a light JS library providing basic asynchronous modal dialogs for webpages, aiming to replace the built-in `alert()`, `prompt()` and `confirm()` which instead block JavaScript execution.
The library provides one function `dialog()` in the global namespace (`window`), taking as argument an object of properties and returning a `Promise` resolving to the result object.
```js
prop = {
type: "alert",
title: "Message",
content: "Hello, world!",
};dialog(prop).then(myFunc);
// Shows the dialog box and calls `myFunc` after closing it
```## How to use ##
The inclusion on a project is straightforward and only consist of adding the script and the default stylesheet:
```html
```
## Documentation ##
A short and effective documentation for all the supported properties can be found at the beginning of the `dialog.js` file.
A more detailed documentation providing examples can be found in the [wiki][1]
## Live demo ##
You can see three live examples [here][2].
## Compatibility ##
The software is compatible with all major browsers. A polyfill might be needed in order to support `Promise`s, no other ES6 features are used.
The stylesheet is W3C valid. A prefixer (like [-prefix-free][3]) might be needed in order to add vendor prefixes.
## License and sharing ##
© 2015 Matteo Bernardini, [@mttbernardini][4].
This project is licensed under the MIT License.
Please refer to the LICENSE file for further information.[1]: https://github.com/mttbernardini/dialog/wiki
[2]: https://mttbernardini.github.io/dialog/demo.html
[3]: https://github.com/LeaVerou/prefixfree
[4]: https://twitter.com/mttbernardini