Demos and documentation here → https://simplydialogs.github.io
A small collection of standard dialogs: alert(), confirm(), error(), info(), bell(), wait(), progress() 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.
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, Tailwind 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 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 > ~18.5kb minified (current version v1.1.0)
Include the script and CSS.
<script src="dist/SimplyDialogs.min.js"></script>
<link rel="stylesheet" type="text/css" href="dist/SimplyDialogs.min.css">Or refer to the .mjs version if you want to use SimplyDialogs as module
import { SimplyDialogs } from './dist/SimplyDialogs.min.mjs'That makes a SimplyDialogs function available. For convenience, create a shorthand alias :
const Dlg = SimplyDialogs
Dlg.alert('Lorem ipsum dolor sit amet')
Dlg.error('Lorem ipsum dolor sit amet')
Dlg.confirm('Lorem ipsum dolor sit amet')
Dlg.info('Lorem ipsum dolor sit amet')
Dlg.bell('Lorem ipsum dolor sit amet')
const wait = Dlg.wait('Lorem ipsum dolor sit amet')
setTimeout(function() {
wait.close()
}, 2000)
const progress = Dlg.progress('Lorem ipsum dolor sit amet', { progress: { max: 100, value: 0 }})
let value = 0
const interval = setInterval(function() {
value++
progress.setValue(value)
if (value === 100) {
clearInterval(interval)
progress.close()
}
}, 50)
Dlg.input('Lorem ipsum dolor sit amet').then(formState => {
console.log(formState)
})






