1.2.7 • Published 5 years ago

modern-modals v1.2.7

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
5 years ago

HTML Modals

import * as  ModernModals from 'modern-modals'
const Modal = new ModernModals.HTMLModal(document.getElementById('modal1'))

Showing

Modal.open()

Hiding

Modal.close()

Select Modal

In these examples, the return value is based on if the user selects Choice 1.

const SelectModal = ModernModals.select({
  title: "Select a choice",
  choices: ["Choice 1", "Choice 2"]
}).then(value => {
  console.log(value) // Choice 1
})
const SelectModal = ModernModals.select({
  title: "Select a choice",
  choices: [
    {text: "Choice 1", value: 1},
    {text: "Choice 2", value: 2}
  ]
}).then(value => {
  console.log(value) // 1
})

Custom Select Modal

      let points = await ModernModals.customPrompt({ title: 'Set reward value.', input: { placeholder: "1200", type: 'number' } });
      console.log(points) // Whatever was typed in (String)

Screenshot

Prompt Modal

const SelectModal = ModernModals.prompt("Exit Page", "Are you sure you would like to leave").then(value => {
  console.log(value) // true or false
})
const SelectModal = ModernModals.prompt("Exit Page").then(value => {
  console.log(value) // true or false
})

Alert Modal

const SelectModal = ModernModals.alert("Exiting Page", "Hope you saved everything.")
const SelectModal = ModernModals.alert("Exiting Page")
1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago