1.1.5 • Published 2 years ago

vue-modality v1.1.5

Weekly downloads
82
License
MIT
Repository
-
Last release
2 years ago

vue-modality

A really nice Vue.js modal component. (compatible with Vue.js 2)

If you are looking for the Vue.js 3 version, visit: vue-modality-v3

Demo

Sandbox

Installation

NPM

$ npm install vue-modality

Register the component globally...

import Vue from 'vue'
import VueModality from 'vue-modality'

Vue.use(VueModality)

... or register it locally

import VueModality from 'vue-modality'
export default {
  components: {
    VueModality
  }
};

Usage

<vue-modality ref="myRef" title="My Title" centered>
  body content
</vue-modality>
// give your modal a ref and open it by calling:
this.$refs.myRef.open()

// or close it by calling:
this.$refs.myRef.hide()

CDN

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue-modality</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="https://unpkg.com/vue-modality"></script>
</head>
<body>
    <h1>Vue-Modality</h1>
    <div id="app">
        <button @click="$refs.example.open()">
            Open the modal
        </button>
        <vue-modality ref="example" @ok="$refs.example.hide()" @cancel="$refs.example.hide()" title="Modal" centered>
            Use the footer buttons to close the modal
        </vue-modality>
    </div>

    <script>
        const vueApp = new Vue({el: '#app'});
    </script>
</body>
</html>

Available props

PropTypeDefaultDescription
widthString400px
centeredBooleanfalseVertically centered
overlayBooleanfalse
text-centerBooleanfalse
titleStringModal
title-classString
hide-headerBooleanfalse
hide-footerBooleanfalse
ok-titleStringOk
ok-disabledBooleanfalse
ok-classString
ok-loadingBooleanfalseShows the loading icon
hide-okBooleanfalseHides the ok button
cancel-titleStringCancel
cancel-disabledBooleanfalse
cancel-classString
hide-cancelBooleanfalseHides the cancel button
no-close-on-backdropBooleanfalse
no-close-on-escBooleanfalse
errorBooleanfalseShows error icon
successBooleanfalseShows success icon

Events

EventDescription
openWhen you open the modal
hideWhen you hide the modal
okWhen the Ok button is pressed
cancelWhen the Cancel button is pressed
1.1.5

2 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago