Create modal dialogs.
https://luna.liriliri.io/?path=/story/modal
Add the following script and style to your page.
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-modal/luna-modal.css" />
<script src="//cdn.jsdelivr.net/npm/luna-modal/luna-modal.js"></script>
You can also get it on npm.
npm install luna-modal --save
import 'luna-modal/luna-modal.css'
import LunaModal from 'luna-modal'
const container = document.getElementById('container')
const modal = new LunaModal(container, {
title: 'This is the Title',
content: 'This is the content.',
})
modal.show()
LunaModal.alert('This is the alert content.')
- content(string | HTMLElement): Modal content.
- footer(string | HTMLElement): Modal footer.
- showClose(boolean): Whether to show close button.
- title(string): Modal title.
- width(number): Modal width.
Hide the modal.
Show the modal.
Like window.alert
.
Like window.confirm
.
Like window.prompt
.
Set alert, prompt, confirm container, need to be called first.