Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.
Add color contextual class.
<div class="alert alert-primary" role="alert">
This is a primary alert—check it out!
</div>
<div class="alert alert-secondary" role="alert">
This is a secondary alert—check it out!
</div>
<div class="alert alert-success" role="alert">
This is a success alert—check it out!
</div>
<div class="alert alert-info" role="alert">
This is a info alert—check it out!
</div>
<div class="alert alert-warning" role="alert">
This is a warning alert—check it out!
</div>
<div class="alert alert-danger" role="alert">
This is a danger alert—check it out!
</div>
Add .alert-icon
class.
<div class="alert alert-icon alert-primary" role="alert">
<i class="fe fe-bell mr-2" aria-hidden="true"></i> You have done 5 actions.
</div>
<div class="alert alert-icon alert-success" role="alert">
<i class="fe fe-check mr-2" aria-hidden="true"></i> The page has been added.
</div>
<div class="alert alert-icon alert-danger" role="alert">
<i class="fe fe-alert-triangle mr-2" aria-hidden="true"></i> The daily report has failed. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
Add a dismiss button and the .alert-dismissible
class, which adds extra padding to the right of the alert and positions the .close
button. On the dismiss button, add the data-dismiss="alert"
attribute, which triggers the JavaScript functionality. Be sure to use the <button>
element with it for proper behavior across all devices.
<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert"></button>
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
<div class="alert alert-avatar alert-primary alert-dismissible">
<span class="avatar" style="background-image: url(./demo/faces/male/4.jpg)"></span>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
<div class="alert alert-avatar alert-success alert-dismissible">
<span class="avatar" style="background-image: url(./demo/faces/male/35.jpg)"></span>
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
Lorem ipsum Minim ad pariatur eiusmod ea ut nulla aliqua est quis id dolore minim voluptate.
<div class="alert alert-success alert-dismissible">
<button data-dismiss="alert" class="close"></button>
<h4>Some Message</h4>
<p>
Lorem ipsum Minim ad pariatur eiusmod ea ut nulla aliqua est quis id dolore minim
voluptate.
</p>
<div class="btn-list">
<button class="btn btn-success" type="button">Okay</button>
<button class="btn btn-secondary" type="button">No, thanks</button>
</div>
</div>