vue-cute-modal
A simple and easy to use Modal component for Vue applications.
Features
- Simple API
- Customizable modal classes
- Customizable Vue transition name
- Name component whatever you like!
Install
For In-DOM templates include the JS CDN and optionally the CSS in your project:
CDN:
https://unpkg.com/vue-cute-modal@1.1.0/dist/vue-cute-modal.min.js
https://unpkg.com/vue-cute-modal@1.1.0/dist/vue-cute-modal.min.css
Usage
Setup
Include the plugin at the root of your application
Creating a Modal
Simply create your modal in your Vue app:
Then open/hide the modal within the app:
Basic Example
Customizing the Component
The plugin comes with some base styles and classes. These may not fit your project and you may wish to override. We can do this via global settings or props.
To override defaults globally pass in the configuration object when you register the component to Vue.use()
:
Alternatively, you could pass props separately to each component. Note that these will override the globally set options.
API
Props
Full prop list
Name | Required | Type | Description |
---|---|---|---|
name | true | String | Name of your modal |
containerClass | false | String | Class name for container of modal |
footerClass | false | String | Modal footer class name |
headerClass | false | String | Modal header class name |
height | false | String | Set the height of the modal |
overlayClass | false | String | Overlay class name |
transition | false | String | Name for Vue transition |
wdith | false | String | Set the width of the modal |
Methods
1.1 Updates
In 1.1 a built in hide method is made available within the header and footer slots. It will be available on the slot-scope
as a method named $hide
. It takes no parameters.
Futhermore, in 1.1 you can globally set a callback function to be ran when a modal is opened or closed using the onOpen
and onClose
keys on your configuration object.