Bootstrap 5 modals are popup dialogs used for confirmations, forms, alerts and more. This page covers 6 modal patterns — from a simple dialog to fullscreen and scrollable modals — each with working copy-paste HTML.
Quick Setup
Modals require Bootstrap 5 JS bundle:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
Key Classes Reference
| Class | What It Does |
|---|---|
.modal | Required wrapper element |
.modal-dialog | Positions and sizes the modal |
.modal-content | White box containing the modal |
.modal-header | Top section with title and close button |
.modal-body | Main content area |
.modal-footer | Bottom section with action buttons |
.modal-dialog-centered | Vertically centers the modal |
.modal-dialog-scrollable | Makes modal body scrollable |
.modal-fullscreen | Covers entire screen |
.modal-sm | Small modal (300px) |
.modal-lg | Large modal (800px) |
.modal-xl | Extra large modal (1140px) |
1. Basic Bootstrap 5 Modal
A simple modal with header, body and footer. Triggered by a button click.
2. Bootstrap 5 Modal with Form
A modal containing a login form. Common pattern for quick sign-in without leaving the page.
3. Bootstrap 5 Confirmation Dialog
A delete confirmation modal with warning icon. Use before destructive actions.
4. Bootstrap 5 Fullscreen Modal
A modal that covers the entire screen. Use modal-fullscreen class on modal-dialog.
5. Bootstrap 5 Modal Sizes
Bootstrap 5 modals come in sm, default, lg and xl sizes. Use modal-sm, modal-lg or modal-xl on modal-dialog.
6. Bootstrap 5 Scrollable Modal
A modal with scrollable body content using modal-dialog-scrollable. Header and footer stay fixed.
Frequently Asked Questions
Need a Full Bootstrap 5 Admin Dashboard?
Get a complete Angular 21 + Bootstrap 5 dashboard with 50+ components — built by the same team behind BootstrapPlanet.
Browse Templates →Use code FIRST30 for 30% off your first purchase.