Alerts Angular Bootstrap 5 Alerts component Responsive Alerts built with Bootstrap 5, Angular and Material Design. Examples of alerts popup such as warning, error or confirmation messages boxes.
Provide contextual feedback messages for typical user actions with a handful of available and flexible alert messages.
Note: Read the API tab to find all available options and advanced customization
Basic examples Click the buttons to launch the alerts.
Primary Secondary Success Danger Warning Info Light Dark A simple secondary alert with
an example link . Give it a click if you like.
You can create alert dynamically from any component using a built-in service. To achieve this, follow these steps:
1. Create a new component with Angular CLI and add some HTML code to the template.
ng generate component alert
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
2. Inject MdbNotificationService
to the component from which you want to open the alert and use the open
method.
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Inject and receive data You can inject data to the alert by passing it to the data
parameter in the alert options.
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Here is an example showing how to use injected data in the alert component:
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Receive data from the alert You can receive data from the alert to use it in other components:
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Here is an example showing how to use data received from alert in other components
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Static examples Use .alert
class, followed by one of the contextual classes .alert-success
, .alert-info
, .alert-warning
, .alert-danger
, .alert-primary
, .alert-secondary
, .alert-light
or .alert-dark
to create an alert.
A simple primary alert—check it out!
A simple secondary alert—check it out!
A simple success alert—check it out!
A simple danger alert—check it out!
A simple warning alert—check it out!
A simple info alert—check it out!
A simple light alert—check it out!
A simple dark alert—check it out!
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Link Color Use .alert-link
class to create matching colored links inside the alert box.
A simple secondary alert with
an example link . Give it a click if you like.
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Additional Content Alerts can contain additional elements like headings, paragraphs and dividers.
Well done! 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.
Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Dismissing It’s possible to dismiss any alert inline.
Holy guacamole! You should check in on some of those fields below.
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Placement You can set the position of every alert using the position
option.
Select horizontal / vertical alignment
Top Bottom
Left Center Right
Current position: top-right Show! Show me wherever you want!
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Offset You can set offset of your alert using a offset
option.
Show alert with offset! Offset: 100px
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.
Stacking You can turn on stacking your alerts using the stacking
oprion.
This is a mobile version of the documentation. View this website on the desktop to copy & edit the source code of the component.