1.0.9 • Published 1 year ago

cube-vue-modal v1.0.9

Weekly downloads
25
License
MIT
Repository
github
Last release
1 year ago

cube-vue-modal

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

Key features

  • Easy to use
  • Simple HTML structure
  • CSS customizable
  • Large content support — addresses the well-known Safari over-scroll chaining issue on iOS

Usage

Install

yarn add cube-vue-modal

Exemple

Template

<div id="App">
  <p>Click the button below to open the modal.</p>
  <button :disabled="open" @click="open = true">Open</button>
  <Modal v-model="open">
    <header>
      <h1 class="modal-title">Title</h1>
    </header>
    <main>
      <p>This is a content.</p>
    </main>
    <footer>
      <button @click="open = false">Close</button>
    </footer>
  </Modal>
</div>

Script

import Modal from 'cube-vue-modal'

export default {
  components: {
    Modal
  },
  data() {
    return {
      open: false
    }
  }
}

SCSS

///
/// Import your own variables
///
@import 'assets/scss/variables';

///
/// Import modal style and animations
///
@import '~cube-vue-modal/src/scss';
/// Or ↴
@import '~cube-vue-modal/src/scss/variables';
@import '~cube-vue-modal/src/scss/modal';
@import '~cube-vue-modal/src/scss/animations';

Props

NameRequiredTypeDefaultDescription
valuefalseBooleanfalseThe open state of the modal.
transitionfalseString'animate'The name of the transition to use for opening and closing.
targetfalseString, Objectdocument.bodyThe querySelector or the Element to append the modal to.

Events

NameDescription
inputThe open state of the modal has changed.
openThe modal is opened.
openedThe modal is opened and the animation is finished.
closeThe modal is closed.
closedThe modal is closed and the animation is finished.

Methods

NameAsyncDescription
opentrueOpens the modal and resolves after the animation is finished.
closetrueCloses the modal and resolves after the animation is finished.
toggletrueSwitches between the open and close methods.

HTML structure and classes

<div class="modal">
  <div class="modal-backdrop"></div>
  <div class="modal-dialog" role="dialog">
    <button class="modal-dialog-close"></button>
    <div class="modal-dialog-container">
      <slot />
    </div>
  </div>
</div>

Development Setup

# Project setup
yarn install

# Compiles and hot-reloads for demo web site development
yarn run serve

# Compiles and minifies for production
yarn run build

# Lints and fixes files
yarn run lint

# Run the unit tests
yarn run test:unit
1.0.9

1 year ago

1.0.8

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.0-beta.11

2 years ago

1.0.0-beta.10

2 years ago

1.0.0-beta.7

2 years ago

1.0.0-beta.8

2 years ago

1.0.0-beta.9

2 years ago

1.0.0-beta.5

2 years ago

1.0.0-beta.6

2 years ago

1.0.0-beta.4

2 years ago

1.0.0-beta.2

3 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta.1

4 years ago

1.0.0-beta.0

4 years ago

0.3.0

4 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago