2.1.0 • Published 3 years ago

shapla-modal v2.1.0

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

shapla-modal

npm npm vue2

A classic modal overlay for Vue.js, in which you can include any content you want.

Table of contents

Installation

npm install --save shapla-modal

Usage

Add the component:

import modal from 'shapla-modal';

export default {
  name: 'Hello',

  components: {
    modal
  },

  data () {
    return {
        modalActive:true,
    };
  },
  
  methods: {
    closeModal(){
      this.modalActive = false;
    }
  }
}
<button @click="modalActive = true">Open Modal</button>
<modal :active="modalActive" title="Modal Title" content-size="full" @close="closeModal">
    Modal content goes here.
    <div slot="foot">
        <button @close="closeModal">Close</button>
    </div>
</modal>

Props

PropertyTypeRequiredDefaultDescription
activeBooleanyes
titleStringnoUntitledtitle will not show if you set type other than card
typeStringnocardCurrently card design available. Use any name like box to get blank modal
closeOnBackgroundClickBooleannotrueIf set true, clicking outside content area will trigger close event.
showCloseIconBooleannotrueIf set false, no closing icon will be shown
contentSizeStringnomediumValue can be small, medium, large or full. small has content width 320px, medium has content width 640px, large has content width 960px and full will take full browser width

Listeners

The modal component fires the following events:

close: When close icon or outside content area is clicked, it fires the event.

<!-- template -->
<modal @close="closeModal">
</modal>


<!-- method -->
methods: {
  closeModal(){
    this.modalActive = false;
  }
}
2.1.0

3 years ago

2.0.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago