Alerts
Alert messages are used to inform users of the status of their action and help them solve any problems that might have occurred. Good design of alert modals is very important for the overall user experience of a website or app.
Default markup
Depending on the information you need to convey, you can use one of the following types of alert messages - success, info, warning or danger. Using the right type of alert modal will help draw users’ attention to the message and prompt them to take action.
<div class="alert alert-success" role="alert">
<h4 class="alert-title">Wow! Everything worked!</h4>
<div class="text-secondary">Your account has been saved!</div>
</div>
Alert links
Add a link to your alert message to redirect users to the details they need to complete or additional information they should read.
Dismissible alerts
Add the x
close button to make an alert modal dismissible. Thanks to that, your alert modal will disappear only once the user closes it.
<div class="alert alert-success alert-dismissible" role="alert">
<div class="d-flex">
<div>
<!-- SVG icon from http://tabler.io/icons/icon/check -->
<svg>...</svg>
</div>
<div>
<h4 class="alert-title">Wow! Everything worked!</h4>
<div class="text-secondary">Your account has been saved!</div>
</div>
</div>
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
</div>
Alerts with icons
Add an icon to your alert modal to make it more user-friendly and help users easily identify the message.
<div class="alert alert-success" role="alert">
<div class="d-flex">
<div>
<!-- SVG icon from http://tabler.io/icons/icon/check -->
<svg>...</svg>
</div>
<div>
<h4 class="alert-title">Wow! Everything worked!</h4>
<div class="text-secondary">Your account has been saved!</div>
</div>
</div>
</div>
To see how the icon affects the alert modal, look at the example below.
Alert with avatar
Add an avatar to your alert modal to make it more personalized.
Alert with buttons
Add primary and secondary buttons to your alert modals if you want users to take a particular action based on the information included in the modal message.
Important alerts
If you want your alert to be really eye-catching, you can add a class alert-important
.
<div class="alert alert-important alert-success alert-dismissible" role="alert">
...
</div>
Look at the example below to see how the important alert affects the alert modal.