Modals
These modular elements can be readily used and customized in every layout across pages.
For detail documentation, View Modals on Bootstrap⟶
Demo
Toggle a working modal demo by clicking the button below. It will slide down and fade in from the top of the page.
HTML
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#exampleModal">Launch demo modal</button>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal Title</h5>
<button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="btn-close"><span class="fw-light" aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<p>Woohoo, you're reading this text in a modal!</p>
</div>
<div class="modal-footer">
<button class="btn btn-secondary btn-sm" type="button" data-bs-dismiss="modal">Close</button>
<button class="btn btn-primary btn-sm" type="button">Save changes</button>
</div>
</div>
</div>
</div>
Change Effect
Add .fade-in
class to .modal
element to change the slide down effect. It will fade in from the page.
HTML
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#exampleFadeInModal">Launch demo modal</button>
<div class="modal fade fade-in" id="exampleFadeInModal" tabindex="-1" role="dialog" aria-labelledby="exampleFadeInModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal Title</h5>
<button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="btn-close"><span class="fw-light" aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<p>Woohoo, you're reading this text in a modal!</p>
</div>
<div class="modal-footer">
<button class="btn btn-secondary btn-sm" type="button" data-bs-dismiss="modal">Close</button>
<button class="btn btn-primary btn-sm" type="button">Save changes</button>
</div>
</div>
</div>
</div>
Modal Size
Modals have four optional sizes, available via modifier classes to be placed on a .modal-dialog
. These sizes kick in at certain breakpoints to avoid horizontal scrollbars on narrower viewports. The sizes are:
.modal-xl
, .modal-lg
, .modal-sm
, .modal-xs