Bootstrap Home

Alerts

Alerts are created with the .alert class, followed by a contextual color class.


Success! This alert box could indicate a successful or positive action.
Info! This alert box could indicate a neutral informative change or action.
Warning! This alert box could indicate a warning that might need attention.
Danger! This alert box could indicate a dangerous or potentially negative action.
Primary! Indicates an important action.
Secondary! Indicates a slightly less important action.
Dark! Dark grey alert.
Light! Light grey alert.

Alert Links

Add the alert-link class to any links inside the alert box to create "matching colored links".


Success! You should read this message.
Info! You should read this message.
Warning! You should read this message.
Danger! You should read this message.
Primary! You should read this message.
Secondary! You should read this message.
Dark! You should read this message.
Light! You should read this message.

Closing Alerts

The button with class="btn-close" and data-bs-dismiss="alert" is used to close the alert box.

The alert-dismissible class aligns the button to the right.


Success! This alert box could indicate a successful or positive action.
Info! This alert box could indicate a neutral informative change or action.
Warning! This alert box could indicate a warning that might need attention.
Danger! This alert box could indicate a dangerous or potentially negative action.
Primary! Indicates an important action.
Secondary! Indicates a slightly less important action.
Dark! Dark grey alert.
Light! Light grey alert.

Animated Alerts

The .fade and .show classes adds a fading effect when closing the alert message.


Success! This alert box could indicate a successful or positive action.
Info! This alert box could indicate a neutral informative change or action.
Warning! This alert box could indicate a warning that might need attention.
Danger! This alert box could indicate a dangerous or potentially negative action.
Primary! Indicates an important action.
Secondary! Indicates a slightly less important action.
Dark! Dark grey alert.
Light! Light grey alert.

Live Example

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.



Additional Content

Alerts can also contain additional HTML elements like headings, paragraphs and dividers.


Icons

Similarly, you can use flexbox utilities and Bootstrap Icons to create alerts with icons.