All Projects → ktsn → vue-thin-modal

ktsn / vue-thin-modal

Licence: MIT license
Thin yet powerful modal component of Vue.js

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects
CSS
56736 projects

Projects that are alternatives of or similar to vue-thin-modal

Django Bootstrap Modal Forms
A Django plugin for creating AJAX driven forms in Bootstrap modal.
Stars: ✭ 244 (+93.65%)
Mutual labels:  modal
MultiDialog
MultiDialog utilizes jQuery UI Dialog Widget for a full featured Modalbox / Lightbox application.
Stars: ✭ 23 (-81.75%)
Mutual labels:  modal
HalfModal
HalfModal mimics the behavior of the drawer of Apple's shortcut application. It is realized using a combination of UIViewPropertyAnimator.
Stars: ✭ 24 (-80.95%)
Mutual labels:  modal
Micromodal
⭕ Tiny javascript library for creating accessible modal dialogs
Stars: ✭ 3,008 (+2287.3%)
Mutual labels:  modal
toppy
Overlay library for Angular 7+
Stars: ✭ 81 (-35.71%)
Mutual labels:  modal
musicWebTemplate
Free website template built for musicians / artists to promote their music and connect to their audience.
Stars: ✭ 26 (-79.37%)
Mutual labels:  modal
Tua Body Scroll Lock
🔐 Body scroll locking that just works with everything
Stars: ✭ 236 (+87.3%)
Mutual labels:  modal
sweet-modal-vue
The sweetest library to happen to modals.
Stars: ✭ 762 (+504.76%)
Mutual labels:  modal
fancybox
jQuery lightbox script for displaying images, videos and more. Touch enabled, responsive and fully customizable.
Stars: ✭ 7,261 (+5662.7%)
Mutual labels:  modal
vue-modal
Reusable Modal component, supports own custom HTML, text and classes.
Stars: ✭ 29 (-76.98%)
Mutual labels:  modal
django-admin-search
Modal filter for django admin
Stars: ✭ 60 (-52.38%)
Mutual labels:  modal
body-scroll-freezer
↕️ Dependency-free JS module to freeze body scroll when opening modal box
Stars: ✭ 22 (-82.54%)
Mutual labels:  modal
jpopup
Simple lightweight (<2kB) javascript popup modal plugin
Stars: ✭ 27 (-78.57%)
Mutual labels:  modal
Nativepopup
Clone of Apple iOS App's feedback popup, and easily customizable.
Stars: ✭ 247 (+96.03%)
Mutual labels:  modal
MultiModal
Use multiple .sheet, .alert, etc. modifiers in the same SwiftUI View
Stars: ✭ 49 (-61.11%)
Mutual labels:  modal
Presentr
iOS let's you modally present any view controller, but if you want the presented view controller to not cover the whole screen or modify anything about its presentation or transition you have to use the Custom View Controller Presentation API's.
Stars: ✭ 2,816 (+2134.92%)
Mutual labels:  modal
react-layer-stack
Layering system for React. Useful for popover/modals/tooltip/dnd application
Stars: ✭ 158 (+25.4%)
Mutual labels:  modal
modalian
Modalian is a simple react modal component with pleasing features
Stars: ✭ 24 (-80.95%)
Mutual labels:  modal
SPLarkController
Custom transition between controllers. Settings controller for your iOS app.
Stars: ✭ 967 (+667.46%)
Mutual labels:  modal
LSDialogViewController
Custom Dialog for iOS written in Swift
Stars: ✭ 74 (-41.27%)
Mutual labels:  modal

vue-thin-modal

Build Status vue-thin-modal Dev Token

vue-thin-modal provides thin but powerful modal component. Its styles, transitions and contents are fully customizable.

Installation

$ npm install --save vue-thin-modal
# or
$ yarn add vue-thin-modal

Usage

  1. Import VueThinModal and install it in Vue constructor.
import Vue from 'vue'
import VueThinModal from 'vue-thin-modal'

Vue.use(VueThinModal)

new Vue({
  // ...
})
  1. (Optional) Import base CSS file for the modal wherever you want or you can define your own styles.
import 'vue-thin-modal/dist/vue-thin-modal.css'
  1. Use <modal> component in your apps. You can see this.$modal in your components
<template>
  <div>
    <button type="button" @click="open">Open Modal</button>
    <modal name="example">
      <div class="basic-modal">
        <h1 class="title">Modal Title</h1>
        <button class="button" type="button" @click="close">Close Modal</button>
      </div>
    </modal>
  </div>
</template>

<script>
export default {
  methods: {
    open () {
      this.$modal.push('example')
    },

    close () {
      this.$modal.pop()
    }
  }
}
</script>

Auto installing vue-thin-modal

If you have Vue constructor on window, you don't need to call Vue.use(VueThinModal) since it will be called automatically. This is the case when you load Vue.js and vue-thin-modal via <script> element.

Manually mount portal

By default, the modal content will be automatically sent just under the <body> element by <modal-portal> component. You can disable this behavior by setting autoMountPortal: false option.

import Vue from 'vue'
import VueThinModal from 'vue-thin-modal'

Vue.use(VueThinModal, {
  autoMountPortal: false
})

In that case, you have to put <modal-portal> by yourself.

<template>
  <div id="app">
    <!-- Application body goes here -->

    <modal-portal />
  </div>
</template>

This is useful when you want to inject some plugin instances from the root Vue instance because the auto-mounted portal will not belong to the user defined root Vue instance. For example, you need to put the portal manually when you use vue-i18n plugin.

import Vue from 'vue'
import VueI18n from 'vue-i18n'
import VueThinModal from 'vue-thin-modal'

Vue.use(VueThinModal, {
  autoMountPortal: false
})

Vue.use(VueI18n)

// Create VueI18n instance with options
const i18n = new VueI18n({
  // vue-i18n options
})


new Vue({
  el: '#app',

  // Since you need to inject i18n instance here,
  // you should put <modal-portal> by yourself.
  i18n,

  // ... remaining options ...
})

References

<modal> component

Props

  • name - String, required

    Required as the modal name. The name must be unique against every modal you would use.

  • pre-mount - Boolean

    If true, the modal contents will be pre mounted into the DOM tree. It is useful if you want to pre load the large images on your modal contents before opened.

  • disable-backdrop - Boolean

    If true, the modal will not be closed by clicking backdrop.

  • content-transition - String | Object

    The transition property for the modal content. When passing String as the value, it will be used as transition name. When passing Object, it may contain the same options for the Vue's <transition> component. If omitted, the default value – { name: 'modal-content' } – will be used.

  • backdrop-transition - String | Object

    Same as content-transition except for the modal backdrop. The default value is { name: 'modal-backdrop' }

Events

  • before-open

    Emitted before opening a modal.

  • opened

    Emitted after opening a modal.

  • before-close

    Emitted before closing a modal.

  • closed

    Emitted after closing a modal.

Slots

  • (default) - A modal content. Must be only element.

  • backdrop - A modal backdrop element.

this.$modal mediator

Properties

  • currentName

    Returns a modal name that appears currently.

Methods

  • push(name: string): void

    Show the modal that cooresponding with the name.

  • pop(): void

    Hide the modal that is appearing.

  • replace(name: string): void

    Hide the modal that is appearing and show a new modal.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].