Blazor UI: Page Alerts
It is common to show error, warning or information alerts to inform the user. An example Service Interruption alert is shown below:
Quick Example
Simply inject IAlertManager
to your page or component and call the Alerts.Warning
method to show a success message.
If you inherit your page or component from the AbpComponentBase
class, you can use the Alerts
property to add alerts.
You typically use
@inherits AbpComponentBase
in the.razor
file to inherit from theAbpComponentBase
, instead of inheriting in the code behind file.
Alert Types
Warning
is used to show a warning alert. Other common methods are Info
, Danger
and Success
.
Beside the standard methods, you can use the Alerts.Add
method by passing an AlertType
enum
with one of these values: Default
, Primary
, Secondary
, Success
, Danger
, Warning
, Info
, Light
, Dark
.
Dismissible
All alert methods gets an optional dismissible
parameter. Default value is true
which makes the alert box dismissible. Set it to false
to create a sticky alert box.