1.3.1 • Published 4 months ago

luna-modal v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Luna Modal

Create modal dialogs.

Demo

https://luna.liriliri.io/?path=/story/modal

Install

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'

Usage

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.')

Configuration

  • 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.

Api

hide(): void

Hide the modal.

show(): void

Show the modal.

static alert(msg: string): Promise

Like window.alert.

static confirm(msg: string): Promise

Like window.confirm.

static prompt(title?: string, defaultText?: string): Promise<null | string>

Like window.prompt.

static setContainer(container: HTMLElement): void

Set alert, prompt, confirm container, need to be called first.

1.3.1

4 months ago

1.3.0

8 months ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.0

2 years ago

1.2.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

4 years ago