RadzenAlert Class

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.

Inheritance

Object

ComponentBase

RadzenComponent

RadzenComponentWithChildren

RadzenAlert

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenAlert : RadzenComponentWithChildren, IComponent, IHandleEvent, IHandleAfterRender

Examples

Basic 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>
}

Constructors

RadzenAlertlink

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.

Declaration
public RadzenAlert()

Properties

AlertStylelink

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.

Declaration
public AlertStyle AlertStyle { get; set; }
Property Value
Type Description
AlertStyleGets 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.

AllowCloselink

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.

Declaration
public bool AllowClose { get; set; }
Property Value
Type Description
boolGets 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.

Closelink

Gets or sets the callback which is invoked when the alert is closed by the user.

Declaration
public EventCallback Close { get; set; }
Property Value
Type Description
EventCallbackGets or sets the callback which is invoked when the alert is closed by the user.

Iconlink

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").

Declaration
public string Icon { get; set; }
Property Value
Type Description
stringGets 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").

IconColorlink

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.

Declaration
public string IconColor { get; set; }
Property Value
Type Description
stringGets 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.

Shadelink

Gets or sets the color intensity shade for the alert. Works in combination with AlertStyle to adjust the color darkness/lightness.

Declaration
public Shade Shade { get; set; }
Property Value
Type Description
ShadeGets or sets the color intensity shade for the alert. Works in combination with AlertStyle to adjust the color darkness/lightness.

ShowIconlink

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.

Declaration
public bool ShowIcon { get; set; }
Property Value
Type Description
boolGets 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.

Sizelink

Gets or sets the size of the alert component. Controls the padding, font size, and icon size within the alert.

Declaration
public AlertSize Size { get; set; }
Property Value
Type Description
AlertSizeGets or sets the size of the alert component. Controls the padding, font size, and icon size within the alert.

Textlink

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.

Declaration
public string Text { get; set; }
Property Value
Type Description
stringGets 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.

Titlelink

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.

Declaration
public string Title { get; set; }
Property Value
Type Description
stringGets 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.

Variantlink

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).

Declaration
public Variant Variant { get; set; }
Property Value
Type Description
VariantGets 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).

VisibleChangedlink

Gets or sets the callback which is invoked when the alert is shown or hidden.

Declaration
public EventCallback<bool> VisibleChanged { get; set; }
Property Value
Type Description
EventCallback<bool>Gets or sets the callback which is invoked when the alert is shown or hidden.

Methods

BuildRenderTreelink

Declaration
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
Parameters
Type Name Description
Rendering.RenderTreeBuilder __builder

GetComponentCssClasslink

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

OnInitializedlink

Declaration
protected override void OnInitialized()

SetParametersAsynclink

Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
Type Name Description
ParameterView parameters
Returns
Type Description
Task
An error has occurred. This app may no longer respond until reloaded. Reload 🗙