vueintermediatemit
Vue Modal
An accessible modal dialog.
5.1k2.1k1.3k248
About this module
A Vue modal with v-model visibility, focus trapping, Escape-to-close and body scroll locking.
#vue#modal#dialog#overlay
Source code
Installation
- 1
Install Vue
Create a Vue 3 project or add the component to an existing one.
npm create vue@latest - 2
Create the component
Create VueModal.vue and paste the source below.
- 3
Import and use
Import the component in your page or parent component and render it.
Usage
- 1
Import the component
Import VueModal in a parent component.
import VueModal from "./components/VueModal.vue"; - 2
Register and render
Register it in your setup and render it in the template.
<script setup> import VueModal from "./components/VueModal.vue"; </script> <template> <vue-modal /> </template>