Demos About Radzen
Search Results for

    Show / Hide Table of Contents

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

    Inheritance
    object
    ComponentBase
    RadzenComponent
    RadzenComponentWithChildren
    RadzenAlert
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    RadzenComponentWithChildren.ChildContent
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.OnContextMenu(MouseEventArgs)
    RadzenComponent.GetCssClass()
    RadzenComponent.GetId()
    RadzenComponent.Debounce(Func<Task>, int)
    RadzenComponent.OnAfterRenderAsync(bool)
    RadzenComponent.RaiseContextMenu(MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.AddContextMenu()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Dispose()
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.Reference
    RadzenComponent.CurrentStyle
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenAlert : RadzenComponentWithChildren, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    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

    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.

    Declaration
    public RadzenAlert()
    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>
    }

    Properties

    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.

    Declaration
    [Parameter]
    public AlertStyle AlertStyle { get; set; }
    Property Value
    Type Description
    AlertStyle

    The alert style. Default is Base.

    AllowClose

    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
    [Parameter]
    public bool AllowClose { get; set; }
    Property Value
    Type Description
    bool

    true to show the close button; otherwise, false. Default is true.

    Close

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

    Declaration
    [Parameter]
    public EventCallback Close { get; set; }
    Property Value
    Type Description
    EventCallback

    Icon

    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
    [Parameter]
    public string Icon { get; set; }
    Property Value
    Type Description
    string

    The custom Material icon name.

    IconColor

    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
    [Parameter]
    public string IconColor { get; set; }
    Property Value
    Type Description
    string

    The icon color as a CSS color value.

    Shade

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

    Declaration
    [Parameter]
    public Shade Shade { get; set; }
    Property Value
    Type Description
    Shade

    The color shade. Default is Default.

    ShowIcon

    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
    [Parameter]
    public bool ShowIcon { get; set; }
    Property Value
    Type Description
    bool

    true to show the contextual icon; otherwise, false. Default is true.

    Size

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

    Declaration
    [Parameter]
    public AlertSize Size { get; set; }
    Property Value
    Type Description
    AlertSize

    The alert size. Default is Medium.

    Text

    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
    [Parameter]
    public string Text { get; set; }
    Property Value
    Type Description
    string

    The alert text content.

    Title

    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
    [Parameter]
    public string Title { get; set; }
    Property Value
    Type Description
    string

    The alert title.

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

    Declaration
    [Parameter]
    public Variant Variant { get; set; }
    Property Value
    Type Description
    Variant

    The alert variant. Default is Filled.

    VisibleChanged

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

    Declaration
    [Parameter]
    public EventCallback<bool> VisibleChanged { get; set; }
    Property Value
    Type Description
    EventCallback<bool>

    Methods

    BuildRenderTree(RenderTreeBuilder)

    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
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    string
    Overrides
    RadzenComponent.GetComponentCssClass()

    OnInitialized()

    Called by the Blazor runtime.

    Declaration
    protected override void OnInitialized()
    Overrides
    RadzenComponent.OnInitialized()

    SetParametersAsync(ParameterView)

    Called by the Blazor runtime when parameters are set.

    Declaration
    public override Task SetParametersAsync(ParameterView parameters)
    Parameters
    Type Name Description
    ParameterView parameters

    The parameters.

    Returns
    Type Description
    Task
    Overrides
    RadzenComponent.SetParametersAsync(ParameterView)

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT