Alerts

Provide contextual feedback messages for typical user actions

Bootstrap docsarrow-right-1


Basic examples

<div class="alert alert-primary" role="alert">
    A simple primary alert—check it out!
</div>

<div class="alert alert-secondary" role="alert">
    A simple secondary alert—check it out!
</div>

<div class="alert alert-success" role="alert">
    <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>

<div class="alert alert-danger" role="alert">
    A simple danger alert—check it out!
</div>

<div class="alert alert-warning" role="alert">
    A simple warning alert—check it out!
</div>

<div class="alert alert-info" role="alert">
    A simple info alert—check it out!
</div>

<div class="alert alert-light text-body" role="alert">
    A simple light alert—check it out!
</div>

<div class="alert alert-dark" role="alert">
    A simple dark alert—check it out!
</div>

Dismissing

It’s possible to dismiss any alert, also keep in closed. Just add an id to the alert and a close button.

<div id="alert-1" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
    You should check in on some of those fields below.
    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
        <svg width="15" height="15" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>remove-bold</title><path d="M22.664,5.578a1.5,1.5,0,0,0,0-2.121L20.543,1.336a1.5,1.5,0,0,0-2.122,0L12.177,7.581a.251.251,0,0,1-.354,0L5.579,1.336a1.5,1.5,0,0,0-2.122,0L1.336,3.457a1.5,1.5,0,0,0,0,2.121l6.245,6.245a.252.252,0,0,1,0,.354L1.336,18.422a1.5,1.5,0,0,0,0,2.121l2.121,2.121a1.5,1.5,0,0,0,2.122,0l6.244-6.245a.251.251,0,0,1,.354,0l6.244,6.245a1.5,1.5,0,0,0,2.122,0l2.121-2.121a1.5,1.5,0,0,0,0-2.121l-6.245-6.245a.252.252,0,0,1,0-.354Z"/></svg>
    </button>
</div>