Press "Enter" to skip to content

Custom Element Modal Web Component Javascript Plugin

Modal Web Components are minimal, reusable vanilla js modal web component written in JavaScript.

pure javascript modal, javascript modal plugin, micromodal js, vanilla js modal, pure css and js modal, javascript modal library, modal js github, what is a modal in web design

How to make use of it:

1. Import modal.js into the document.

<script src="./modal.js"></script>

2. Add the custom element <mc-modal /> to the page.

<mc-modal id="modal">
  <h2>Modal Component</h2>
  <p>Built using Web Component</p>
  <form action="#" method="POST">
    <label class="sr-only" for-id="password">Your Password:</label>
    <input type="password" id="password" name="password" placeholder="Password" />
    <div class="buttons">
      <div id="closeModal" class="button grey cancel">Cancel</div>
      <button class="red">Confirm</button>
    </div>
  </form>
</mc-modal>

3. Enable an item to switch modal.

openModal.addEventListener('click', () => modal.open())

4. Enable the cancel button to close the form.

closeModal.addEventListener('click', () => modal.close())

Minimal Modal Web Component Plugin/Github


See Demo And Download

Official Website(maykbrito): Click Here

This superior jQuery/javascript plugin is developed by maykbrito. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *