An alert/notification box component for displaying important messages with semantic colors and optional close functionality. RadzenAlert provides contextual feedback messages for Success, Info, Warning, Error, and other notification scenarios. Supports semantic styles (Info, Success, Warning, Danger) for contextual coloring, variants (Filled, Flat, Outlined, Text), automatic contextual icons or custom icons via Icon property, optional close button via AllowClose for dismissible alerts, sizes (ExtraSmall, Small, Medium, Large), and content via Title/Text properties or rich content via ChildContent. Automatically displays appropriate icons based on AlertStyle (checkmark for Success, warning triangle for Warning, etc.) unless ShowIcon is set to false or a custom Icon is provided.
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponentWithChildren.ChildContent
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenAlert : RadzenComponentWithChildren, IComponent, IHandleEvent, IHandleAfterRenderBasic success alert:
<RadzenAlert AlertStyle="AlertStyle.Success" Title="Success!" Text="Operation completed successfully." />
Warning alert with custom content:
<RadzenAlert AlertStyle="AlertStyle.Warning" AllowClose="false" ShowIcon="true">
<strong>Warning:</strong> Your session will expire in 5 minutes.
</RadzenAlert>
Dismissible info alert:
@if (showAlert)
{
<RadzenAlert AlertStyle="AlertStyle.Info" Variant="Variant.Flat"
AllowClose="true" Close=@(() => showAlert = false)>
This is an informational message that can be dismissed.
</RadzenAlert>
}An alert/notification box component for displaying important messages with semantic colors and optional close functionality. RadzenAlert provides contextual feedback messages for Success, Info, Warning, Error, and other notification scenarios. Supports semantic styles (Info, Success, Warning, Danger) for contextual coloring, variants (Filled, Flat, Outlined, Text), automatic contextual icons or custom icons via Icon property, optional close button via AllowClose for dismissible alerts, sizes (ExtraSmall, Small, Medium, Large), and content via Title/Text properties or rich content via ChildContent. Automatically displays appropriate icons based on AlertStyle (checkmark for Success, warning triangle for Warning, etc.) unless ShowIcon is set to false or a custom Icon is provided.
public RadzenAlert()Gets or sets the semantic style/severity of the alert. Determines the color scheme and default icon: Info (blue), Success (green), Warning (orange), Danger (red), etc.
public AlertStyle AlertStyle { get; set; }
| Type | Description |
|---|---|
| AlertStyle | Gets or sets the semantic style/severity of the alert. Determines the color scheme and default icon: Info (blue), Success (green), Warning (orange), Danger (red), etc. |
Gets or sets whether the alert can be dismissed by showing a close button. When enabled, a small X button appears in the top-right corner allowing users to close the alert. Handle the Close event to perform actions when the alert is dismissed.
public bool AllowClose { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether the alert can be dismissed by showing a close button. When enabled, a small X button appears in the top-right corner allowing users to close the alert. Handle the Close event to perform actions when the alert is dismissed. |
Gets or sets the callback which is invoked when the alert is closed by the user.
public EventCallback Close { get; set; }
| Type | Description |
|---|---|
| EventCallback | Gets or sets the callback which is invoked when the alert is closed by the user. |
Gets or sets a custom Material icon name to display instead of the default contextual icon. Overrides the automatic icon selection based on AlertStyle. Use Material Symbols icon names (e.g., "info", "warning", "check_circle").
public string Icon { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets a custom Material icon name to display instead of the default contextual icon. Overrides the automatic icon selection based on AlertStyle. Use Material Symbols icon names (e.g., "info", "warning", "check_circle"). |
Gets or sets a custom color for the alert icon. Supports any valid CSS color value. If not set, the icon color matches the alert's semantic style.
public string IconColor { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets a custom color for the alert icon. Supports any valid CSS color value. If not set, the icon color matches the alert's semantic style. |
Gets or sets the color intensity shade for the alert. Works in combination with AlertStyle to adjust the color darkness/lightness.
public Shade Shade { get; set; }
| Type | Description |
|---|---|
| Shade | Gets or sets the color intensity shade for the alert. Works in combination with AlertStyle to adjust the color darkness/lightness. |
Gets or sets whether to display the contextual icon based on the AlertStyle. When true, shows an appropriate icon (checkmark for Success, info icon for Info, warning for Warning, etc.). Set to false to hide the icon, or provide a custom icon via the Icon property.
public bool ShowIcon { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether to display the contextual icon based on the AlertStyle. When true, shows an appropriate icon (checkmark for Success, info icon for Info, warning for Warning, etc.). Set to false to hide the icon, or provide a custom icon via the Icon property. |
Gets or sets the size of the alert component. Controls the padding, font size, and icon size within the alert.
public AlertSize Size { get; set; }
| Type | Description |
|---|---|
| AlertSize | Gets or sets the size of the alert component. Controls the padding, font size, and icon size within the alert. |
Gets or sets the body text of the alert. This appears below the title as the main alert message. Overridden by ChildContent if custom content is provided.
public string Text { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the body text of the alert. This appears below the title as the main alert message. Overridden by ChildContent if custom content is provided. |
Gets or sets the title text displayed prominently at the top of the alert. Use this for the main alert heading, with additional details in Text or custom content via ChildContent.
public string Title { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the title text displayed prominently at the top of the alert. Use this for the main alert heading, with additional details in Text or custom content via ChildContent. |
Gets or sets the design variant that controls the alert's visual appearance. Options include Filled (solid background), Flat (subtle background), Outlined (border only), and Text (minimal styling).
public Variant Variant { get; set; }
| Type | Description |
|---|---|
| Variant | Gets or sets the design variant that controls the alert's visual appearance. Options include Filled (solid background), Flat (subtle background), Outlined (border only), and Text (minimal styling). |
Gets or sets the callback which is invoked when the alert is shown or hidden.
public EventCallback<bool> VisibleChanged { get; set; }
| Type | Description |
|---|---|
| EventCallback<bool> | Gets or sets the callback which is invoked when the alert is shown or hidden. |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | __builder |
protected override string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
public override Task SetParametersAsync(ParameterView parameters)
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters |
| Type | Description |
|---|---|
| Task |