Skip to content

Magic Modal

Package
@maas/vue-equipment/plugins
Last Changed
6 days ago

A simple component and api to trigger modals from anywhere

Demo

Usage

js
import { MagicModalPlugin } from '@maas/vue-equipment/plugins'
import { createApp } from 'vue'

const app = createApp({})

app.use(MagicModalPlugin)
html
<template>
  <MagicModal id="magic-modal--demo">
    <div tabindex="1" />
  </MagicModal>
</template>

Trigger

html
<template>
  <button @click="open">Open</button>
</template>

<script setup>
  import { useMagicModal } from '@maas/vue-equipment/plugins'

  const modalApi = useMagicModal('magic-modal--demo')
  const { open } = modalApi
</script>

Released under the MIT License.