Responsive Alerts built with the latest Bootstrap 5. Alerts provide contextual feedback messages for typical user actions with a handful of responsible and flexible alert boxes.
Provide contextual feedback messages for typical user actions with the handful of available
and flexible alert messages.
Note: Read the API tab to find all available options and
advanced customization
Basic examples
Click the buttons to launch the alerts.
A simple primary alert with
an example link. Give it a click if you like.
A simple secondary alert with
an example link. Give it a click if you like.
A simple success alert with
an example link. Give it a click if you like.
A simple danger alert with
an example link. Give it a click if you like.
A simple warning alert with
an example link. Give it a click if you like.
A simple info alert with
an example link. Give it a click if you like.
A simple light alert with
an example link. Give it a click if you like.
A simple dark alert with
an example link. Give it a click if you like.
<!-- Trigger buttons -->
<button type="button" id="primary" class="btn btn-primary m-1">Primary</button>
<button type="button" id="secondary" class="btn btn-secondary m-1">Secondary</button>
<button type="button" id="success" class="btn btn-success m-1">Success</button>
<button type="button" id="danger" class="btn btn-danger m-1">Danger</button>
<button type="button" id="warning" class="btn btn-warning m-1">Warning</button>
<button type="button" id="info" class="btn btn-info m-1">Info</button>
<button type="button" id="light" class="btn btn-light m-1">Light</button>
<button type="button" id="dark" class="btn btn-dark m-1">Dark</button>
<!-- Alerts -->
<div
class="alert fade"
id="alert-primary"
role="alert"
data-mdb-color="primary"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple primary alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div
class="alert fade"
id="alert-secondary"
role="alert"
data-mdb-color="secondary"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple secondary alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div
class="alert fade"
id="alert-success"
role="alert"
data-mdb-color="success"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple success alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div
class="alert fade"
id="alert-danger"
role="alert"
data-mdb-color="danger"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple danger alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div
class="alert fade"
id="alert-warning"
role="alert"
data-mdb-color="warning"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple warning alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div
class="alert fade"
id="alert-info"
role="alert"
data-mdb-color="info"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple info alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div
class="alert fade"
id="alert-light"
role="alert"
data-mdb-color="light"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple light alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div
class="alert fade"
id="alert-dark"
role="alert"
data-mdb-color="dark"
data-mdb-position="top-right"
data-mdb-stacking="true"
data-mdb-width="535px"
data-mdb-width="535px"
data-mdb-append-to-body="true"
data-mdb-hidden="true"
data-mdb-autohide="true"
data-mdb-delay="2000"
>
A simple dark alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="primary">
A simple primary alert—check it out!
</div>
<div class="alert" role="alert" data-mdb-color="secondary">
A simple secondary alert—check it out!
</div>
<div class="alert" role="alert" data-mdb-color="success">
A simple success alert—check it out!
</div>
<div class="alert" role="alert" data-mdb-color="danger">
A simple danger alert—check it out!
</div>
<div class="alert" role="alert" data-mdb-color="warning">
A simple warning alert—check it out!
</div>
<div class="alert" role="alert" data-mdb-color="info">
A simple info alert—check it out!
</div>
<div class="alert" role="alert" data-mdb-color="light">
A simple light alert—check it out!
</div>
<div class="alert" role="alert" data-mdb-color="dark">
A simple dark alert—check it out!
</div>
Link Color
A simple primary alert with
an example link. Give it a click if you like.
A simple secondary alert with
an example link. Give it a click if you like.
A simple success alert with
an example link. Give it a click if you like.
A simple danger alert with
an example link. Give it a click if you like.
A simple warning alert with
an example link. Give it a click if you like.
A simple info alert with an example link. Give it a
click if you like.
A simple light alert with
an example link. Give it a click if you like.
A simple dark alert with an example link. Give it a
click if you like.
<div class="alert" role="alert" data-mdb-color="primary">
A simple primary alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="secondary">
A simple secondary alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="success">
A simple success alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="danger">
A simple danger alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="warning">
A simple warning alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="info">
A simple info alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="light">
A simple light alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert" role="alert" data-mdb-color="dark">
A simple dark alert with
<a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
Aww yeah, you successfully read this important alert message. This example text is going
to run a bit longer so that you can see how spacing within an alert works with this kind
of content.
Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
<div class="alert" role="alert" data-mdb-color="success">
<h4 class="alert-heading">Well done!</h4>
<p>
Aww yeah, you successfully read this important alert message. This example text is
going to run a bit longer so that you can see how spacing within an alert works with
this kind of content.
</p>
<hr />
<p class="mb-0">
Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
</p>
</div>
Dismissing
Using the alert JavaScript plugin, it’s possible to dismiss any alert inline. Here’s how:
Be sure you’ve loaded the alert plugin, or the compiled Bootstrap JavaScript.
Add a close button and the .alert-dismissible class, which adds extra padding
to the right of the alert and positions the close button.
On the close button, add the data-mdb-dismiss="alert" attribute, which triggers
the JavaScript functionality. Be sure to use the button element with it for
proper behavior across all devices.
To animate alerts when dismissing them, be sure to add the
.fade and .show classes.
You can see this in action with a live demo:
Holy guacamole! You should check in on some of those fields below.
<div class="alert alert-dismissible fade show" role="alert" data-mdb-color="warning">
<strong>Holy guacamole!</strong> You should check in on some of those fields below.
<button
type="button"
class="btn-close"
data-mdb-dismiss="alert"
aria-label="Close"
></button>
</div>