Demos and documentation here ⇨ https://simplydialogs.github.io
A small collection of standard dialogs: alert()
, confirm()
, error()
, info()
, bell()
, wait()
and input()
.
Built with ES6 and unicode, utilizing the native <dialog>
HTML element. Works in all modern browsers. Tested with Chrome, Opera, Firefox and Edge (Linux & Windows 10).
Use SimplyDialogs if you just need some dialogs on a minimalistic webpage - or want a quick alternative to the built-in dialogs or modals provided by your favourite framework, like Bootstrap, MaterializeCSS or similar. You can customize the layout so it get the look of your theme / framework.
- No dependencies; using native <dialog> element and unicode
- Truly blocking interaction with background
- Stays in center of viewport, adjusted to message size, stays in focus while scrolling
- Return promises
- Support keyboard / mouse the right way
- Highly customizeable
- Stackable
- Neat exploding / imploding effect without exaggerating
- No forced styling (beyond very basics), adopts the current "theme"
- Very small footprint, JS + CSS > ~17.3kb minified (current version v1.0.11)
Include the script and CSS.
<script src="path/to/simplydialogs/dist/SimplyDialogs.min.js"></script>
<link rel="stylesheet" type="text/css" href="path/to/simplydialogs/dist/SimplyDialogs.min.css">
That makes a SimplyDialogs function available. For convenience, create a shorthand alias :
const Dlg = SimplyDialogs
Dlg.alert('Lorem ipsum dolor sit amet, consectetur adipiscing elit')
Dlg.error('Lorem ipsum dolor sit amet, consectetur adipiscing elit')
Dlg.confirm('Lorem ipsum dolor sit amet, consectetur adipiscing elit')
Dlg.info('Lorem ipsum dolor sit amet, consectetur adipiscing elit')
Dlg.bell('Lorem ipsum dolor sit amet, consectetur adipiscing elit')
const wait = Dlg.wait('Lorem ipsum dolor sit amet, consectetur adipiscing elit')
wait.close()
Dlg.input('Lorem ipsum dolor sit amet, consectetur adipiscing elit').then(formState => {
console.log(formState)
})