vue-slim-modal

Slim modal component for Vue.js
30,308 11
Install
npm install vue-slim-modal
Latest Version:1.0.4
Older releases:2
License:MIT
Last Updated:Dec 25, 2021
Links: GitHub  ·  npm
Maintainer: rem

vue-slim-modal

NPM version NPM downloads Build Status donate

Features

  • Functional component
  • Minimal design
  • Light-weight, 1KB and that's all!

Install

yarn add vue-slim-modal

CDN: UNPKG | jsDelivr

Usage

<template>
  <div id="example">
    <button @click="toggle">Toggle Modal</button>
    <modal :is-open="isOpen">
      <h2>title></h2>
      <p>text goes here...</p>
    </modal>
  </div>
</template>

<script>
import Modal from 'vue-slim-modal'

export default {
  components: { Modal },
  data() {
    return { 
      isOpen: false
    }
  },
  methods: {
    toggle() {
      this.isOpen = !this.isOpen
    }
  }
}
</script>

<!-- Optionally use our default style -->
<style src="vue-slim-modal/themes/default.css"></style>

Vist https://egoistian.com/vue-slim-modal (source code) for an online demo.

Props

<Modal>

Add attributes excepts below props will go to .modal element, eg: <Modal class="foo" /> results in:

<div class="modal-overlay">
  <div class="foo modal">
  </div>
</div>
isOpen

Type: boolean Default: false

isCenter

Type: boolean Default: false

Position the modal at absolute center, by default it's 100px from the top.

clickOutside

Type: function Default: noop

The function to invoke as user clicks outside the modal.

overlayClass

Type: string Default: undefined

Add extra class name to .modal-overlay element.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Development

Run the example with Poi:

cd vue-slim-modal
yarn
yarn dev

License

MIT © EGOIST

Related Packages

vue-use-modal-context

Vue modal helpers for simplify modal usage

911 4
@ztrehagem/vue-modal

Stacking-managed styleless modal library for Vue.js.

843 0
cube-vue-modal

A simple, basic, highly customizable and mobile friendly modal component for Vue...

798 2
@sygnas/vue-modal

Vue で簡易的なモーダルを実装(自分用)。

598 0
@bardoui/vmodal

Modal for Vue 3

575

Version History

Version Released License
1.0.4 MIT
1.0.3 MIT
1.0.2 MIT
1.0.1 MIT
1.0.0 MIT