1.0.7 • Published 6 months ago

web-component-vanilla-modal v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Web Component Vanilla Modal

NPM License

Lightweight, easy to use & customizable modal < 10k 😎 Compatible with React, Vue, Angular & other frameworks. Add your modal content with a Slot element.

vanilla-modal

Vue Usage

npm i web-component-vanilla-modal

<script setup>
import VanillaModal from 'web-component-vanilla-modal';

let modalElement = null;

onMounted(() => {
  modalElement = document.getElementById('vanilla-modal');
  const buttonElement = document.querySelector('#open-modal-button');
  buttonElement.addEventListener('click', handleOpenModal);
});

function handleOpenModal(event) {
  modalElement.open();
}

</script>


<template>
<vanilla-modal id="vanilla-modal" >
    <div slot="custom-slot">
        Your next modal content
    </div>
</vanilla-modal>
</template>

vite config

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag.includes('vanilla-modal')
        }
      }
    })
  ],

Contact

Feel free to ping me 💫 connect@giladshohat.com

giladshohat.com

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago