How to make a modal fullscreen?

ConfusedCoder picture ConfusedCoder · Mar 25, 2019 · Viewed 11.7k times · Source

I am trying to make a bootstrap vue modal fullscreen. Which css classes should I override, I want to do this in a scoped style in the component that will use this modal.

Answer

brooksrelyt picture brooksrelyt · Mar 25, 2019

You want to edit .modal-dialog and force the dimensions.

Example CSS:

.modal-dialog {
    max-width: 100%;
    margin: 0;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100vh;
    display: flex;
}

Additionally to get this working in vue. You can try adding a class to b-modal and trying something like this:

<div>
  <b-button v-b-modal.modal1>Launch demo modal</b-button>

  <!-- Modal Component -->
  <b-modal class="test-modal" id="modal1" title="BootstrapVue">
    <p class="my-4">Hello from modal!</p>
  </b-modal>
</div>

CSS:

.test-modal .modal-dialog {
    max-width: 100%;
    margin: 0;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100vh;
    display: flex;
    position: fixed;
    z-index: 100000;
}