Bootstrap 5 alerts provide contextual feedback messages for user actions. This page covers 4 alert patterns — basic colors, dismissible, with icons and custom styled — each ready to copy into your project.
Quick Setup
Dismissible alerts require Bootstrap 5 JS:
<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 |
|---|---|
.alert | Required base class |
.alert-success | Green success alert |
.alert-danger | Red error alert |
.alert-warning | Yellow warning alert |
.alert-info | Blue info alert |
.alert-primary | Brand blue alert |
.alert-dismissible | Adds space for close button |
.fade.show | Enables fade animation on dismiss |
.alert-link | Styles links inside alerts |
data-bs-dismiss="alert" | Closes alert on button click |
1. Bootstrap 5 Basic Alerts
All Bootstrap 5 alert color variants — success, info, warning, danger, primary, secondary, light and dark.
2. Bootstrap 5 Dismissible Alerts
Alerts with a close button using alert-dismissible and data-bs-dismiss. Requires Bootstrap JS.
3. Bootstrap 5 Alerts with Icons
Alerts with Bootstrap Icons for a more visual and professional look.
4. Bootstrap 5 Custom Styled Alerts
Custom alerts with modern styling, icons and action buttons — great for onboarding and notification banners.
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.