Stackable modal

Stackable modals is a library for modal dialogs which can be infinitely stacked. The component uses bootstrap for styling the modal but DOES NOT include it by default - you need to import it yourself.

When you open a second dialog the first one is scaled to 0.9 and position behind


npm i @innologica/vue-stackable-modal --save


yarn add @innologica/vue-stackable-modal

import to use:

import StackModal from '@innologica/vue-stackable-modal'


Source code

    <div class="py-4">
        <button class="btn btn-primary" @click="show=true">Open modal</button>

                title="Modal #1"
            <button class="btn btn-info" @click="show_second=true">Open modal 2</button>

            <p>I have no title so the modal-header is missing.</p>

            <button class="btn btn-warning" @click="show_third=true">Open modal 3</button>

                title="Last modal"
            <p>This is the last modal. This modal has closeOnEscape set to false so you cannot close it via ESC key.</p>


  import StackModal from '../../../src/components/StackModal'

  export default {
    name: "StackableModalDemo",
    components: { StackModal },
    data () {
      return {
        show: false,
        show_second: false,
        show_third: false,

    @import "";

<style lang="scss">
    @import "../../../src/assets/transitions/translate-fade.scss";


Prop Type Default Description
show Boolean false Shows/hides the modal
title String The title of the modal shown in .modal-header div. If empty the div is not rendered
modalClass Object {} :class object which is attached to the modal dialog element
hasBackdrop Boolean true Whether to display backdrop element for this dialog. It is added to the body with calculated z-index.
saveButton Object { title: 'Save', visible: true, btnClass: {'btn btn-primary': true}} Save button config
cancelButton Object { title: 'Cancel', visible: true, btnClass: {'btn btn-outline-secondary': true}} Cancel button config
transition String translate-fade* Transition to use when showing the modal.You need to include scss with the transition
closeOnEscape Boolean true If enabled the component attaches event handler on document body which monitors for ESC and emits the 'close' event.

*for the default transition you need to @import "~@innologica/vue-stackable-modal/src/assets/transitions/translate-fade.scss";


Event Params Description
save none When the save button is pressed
close none When the cancel button is pressed, or the "x" in the title is clicked, or escape is pressed. Yoo need to close the modal via the show property
show show, index, total Called when the modal show/hides. show - open/close, index - the index in the current stack, total - total modals open



This slot is the content of the modal.

Default value:

<slot name="modal-header">
    <div class="modal-header" v-if="title">
        <h5 class="modal-title">{{title}}</h5>
        <a class="close" aria-label="Close" @click.stop="$emit('close')">
            <span aria-hidden="true">×</span>

The modal header is rendered above the content. If title is empty then it is not rendered

Default value:

<slot name="modal-footer">
    <div class="modal-footer">
                :class="{ ...saveButtonOptions.btnClass }"
                :class="{ ...cancelButtonOptions.btnClass }"

This is the modal footer with the 2 buttons. If you just want to hide the footer you can provide empty footer slot e.g.:

<div slot="modal-footer"></div>