Alerts

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

Examples

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

                      
                        <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-danger" role="alert">
                          This is a danger 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-info" role="alert">
                          This is a info alert — check it out!
                        </div>
                        <div class="alert alert-dark" role="alert">
                          This is a dark alert — check it out!
                        </div>
                      
                    
Conveying meaning to assistive technologies

Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.

Icons

                      
                        <div class="alert alert-primary alert-dismissible fade show" role="alert">
                          <i class="fas fa-peace mr-2"></i> This is a primary alert — check it out!
                        </div>

                        <div class="alert alert-secondary alert-dismissible fade show" role="alert">
                          <i class="fas fa-thumbs-up mr-2"></i> This is a secondary alert — check it out!
                        </div>

                        <div class="alert alert-danger alert-dismissible fade show" role="alert">
                          <i class="fas fa-hand-pointer mr-2"></i> This is a danger alert — check it out!
                        </div>

                        <div class="alert alert-dark alert-dismissible fade show" role="alert">
                          <i class="fas fa-handshake mr-2"></i> This is a dark alert — check it out!
                        </div>
                      
                    

JavaScript behavior

For more information, see the official Bootstrap documentation.