Create Custom and Dynamic Modals Component | Xmodal-Vue

Xmodal-Vue is a simplified, lightweight (5KB compressed), and an easy-to-use wrapper around your components that will help you create custom, dynamic, models from your components.

vue js modal popup example, vue js modal documentation, bootstrap 5 modal component, vue open modal from another component, v modal vue

iOS Style Modal Dialog Web and Mobile Component | pure-dialog

How to make use of it:

Install and download:

# Yarn
$ yarn add xmodal-vue

# NPM
$ npm i xmodal-vue

1. Import xmodal file.

import Vue from "vue";
import xmodal from "xmodal-vue";

2. Register the component.

export default {
  data() {
    return {
        ismodalOpen: false,
        // basic modal options
        options: {
            component: modal,
            backgroundColor: "#000000",
            opacity: "0.7",
            animation: "scaleLeft",
        },
    };
  }
};

3. Create a button to toggle the modal.

<template>
  <div id="app">
    <h1>xmodal</h1>
    <button @click="ismodalOpen = !ismodalOpen">open modal</button>
    <xmodal v-model="ismodalOpen" :params="options" />
  </div>
</template>

4. Add your own content to the modal.

// modal.vue
<template>
  <div class="modal">
    <h1>Modal Content</h1>
  </div>
</template>

5. Apply CSS styles to the modal.

.modal {
  width: 300px;
  height: 300px;
  background: white;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

6. All options and props are default.

//GLOBAL
component: {
  default: null
},
// MODAL OPTIONS
backgroundColor: {
  type: String,
  default: "#000000"
},
opacity: {
  type: String,
  default: "0.7"
},
hasTimer: {
  default: false
},
animation: {
  type: String,
  default: "fade"
},
isDisable: {
  type: Boolean,
  default: false
},
// COMPONENT OPTIONS
props: {
  type: Object,
  default: null
}

Dynamic And Custom Modal Component, Xmodal-Vue Plugin/Github


See Demo And Download

Official Website(mediv0): Click Here

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

Related Posts

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Bootstrap-4-Toast-Notification-Plugin

Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Audio-Visualizations-Wave

How to Create Audio Visualizations with JavaScript | Wave.js

Audio Visualizer Library – wave.js is a vanilla javascript audio visualization library that provides 20+ creative audio visualization effects to bring more engagement to your visitor. Contribute…

swiper-touch-slider

Modern Mobile Touch Slider With Acceleration Transitions | Swiper

Swiper is the most modern free mobile touch slider with accelerated device transitions and amazing original behavior. It is intended for use in mobile websites, mobile web…

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

Leave a Reply

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