1.0.1 • Published 3 years ago

@mtcmedia/vue-overlay v1.0.1

Weekly downloads
6
License
-
Repository
-
Last release
3 years ago

@mtcmedia/vue-overlay

Install to production site

npm install @mtcmedia/vue-overlay

Usage

import MtcOverlay from '@mtcmedia/vue-overlay'

Vue.component('MtcOverlay', MtcOverlay)
<button @click.prevent="showOverlay = true">Open Overaly</button>
<MtcOverlay
    :is-visible="showOverlay"
    @closeOverlay="showOverlay = false"
>
    <!-- this is the main slot -->
    <h2>Add overlay content here!</h2>
    <p>This can be anything</p>
</MtcOverlay>

Props

The component accepts these props:

AttributeTypeDefaultDescription
is-visibleBooleanfalseShow the overlay by passing data that can be toggled
titleStringemptyDefine a title for your overlay - populates aria-label on the overlay
site-wrapperString.siteWrapperDefine a selector for your site container. Needed to keep scroll position on open of overlay

Slots

The component accepts these slots:

  • default : the content of the overlay
  • icon : change the icon used for the close button, this can be anything

Events

The component fires the following events:

AttributeDescription
closeOverlayFires when user clicks on close button, overlay shadow or presses escape key. Use this to set is-visible back to false to hide the overlay
beforeOpenFires before the overlay transitions into view
afterOpenFires after the overlay transitions into view
afterCloseFires after the overlay transitions out of view

Development Setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Run your unit tests

npm run test:unit

Lints and fixes files

npm run lint

Customize configuration

See Configuration Reference.

1.0.1

3 years ago

1.0.0

3 years ago

0.3.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago