Bootstrap Components

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

Alerts are available for any length of text, as well as an optional close button. For proper styling, use one of the eight contextual classes (e.g., .alert-success). For inline dismissal, use the alerts JavaScript plugin.

 <div class="alert alert-primary d-flex align-items-center" role="alert">
     <i class="fa fa-info fs-4 flex-shrink-0 me-2"></i>
     <div>Primary alert. Everything is in order. Here is an <a href="#" class="alert-link">example link</a></div>
 </div>

Use the .alert-link utility class to quickly provide matching colored links within any alert.

Click the button below to show an alert (hidden with inline styles to start), then dismiss (and destroy) it with the built-in close button.

Small count and labeling component.

Badges scale to match the size of the immediate parent element by using relative font sizing and em units.

Example H1 heading New

Example H2 heading New

Example H3 heading New

 <h1>Example H1 heading <span class="badge bg-secondary">New</span></h1>

Badges can be used as part of links or buttons to provide a counter.

 <button type="button" class="btn btn-primary">
     Notifications <span class="badge text-bg-light">4</span>
 </button>

Use utilities to modify a .badge and position it in the corner of a link or button.

 <button type="button" class="btn btn-primary position-relative">
     Inbox
     <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
         99+
         <span class="visually-hidden">unread messages</span>
     </span>
 </button>

You can also replace the .badge class with a few more utilities without a count for a more generic indicator.

 <button type="button" class="btn btn-primary position-relative">
     Profile
     <span class="position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle">
         <span class="visually-hidden">New alerts</span>
     </span>
 </button>

Set a background-color with contrasting foreground color with .text-bg-{color} helpers .

primary secondary success warning danger light dark
 <span class="badge text-bg-danger">danger</span>

Use the .rounded-pill utility class to make badges more rounded with a larger border-radius.

primary secondary success warning danger light dark
 <span class="badge rounded-pill text-bg-success">success</span>