Table of Contents

Class MudAlert

Namespace
MudBlazor
Assembly
MudBlazor.dll

Represents an alert used to display an important message which is statically embedded in the page content.

public class MudAlert : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged
Inheritance
MudAlert
Implements
Inherited Members
Extension Methods

Constructors

MudAlert()

public MudAlert()

Fields

_icon

protected string? _icon

Field Value

string

Properties

ChildContent

Content within the alert.

[Parameter]
[Category("Behavior")]
public RenderFragment? ChildContent { get; set; }

Property Value

RenderFragment

Remarks

This property allows for custom content to displayed inside of the alert, but is not required.

ClassPosition

protected string ClassPosition { get; }

Property Value

string

Classname

protected string Classname { get; }

Property Value

string

CloseIcon

Icon used for the close button.

[Parameter]
[Category("Appearance")]
public string CloseIcon { get; set; }

Property Value

string

Remarks

Defaults to Close. This icon is only displayed when the ShowCloseIcon property is true.

CloseIconClicked

Occurs when the close button has been clicked.

[Parameter]
public EventCallback<MudAlert> CloseIconClicked { get; set; }

Property Value

EventCallback<MudAlert>

ContentAlignment

Position of the text to the start (Left in LTR and right in RTL).

[Parameter]
[Category("Appearance")]
public HorizontalAlignment ContentAlignment { get; set; }

Property Value

HorizontalAlignment

Remarks

Defaults to Left.

Dense

Uses compact padding.

[Parameter]
[Category("Appearance")]
public bool Dense { get; set; }

Property Value

bool

Remarks

Defaults to false.

Elevation

Size of the drop shadow.

[Parameter]
[Category("Appearance")]
public int Elevation { get; set; }

Property Value

int

Remarks

Defaults to 0. A higher number creates a heavier drop shadow. Use a value of 0 for no shadow.

Icon

Icon displayed for this alert.

[Parameter]
[Category("Appearance")]
public string? Icon { get; set; }

Property Value

string

Remarks

Defaults to null. When set, the custom icon will be displayed. Otherwise, the icon will depend on the Severity property.

NoIcon

Displays the alert without an icon.

[Parameter]
[Category("Appearance")]
public bool NoIcon { get; set; }

Property Value

bool

Remarks

Defaults to false. To customize the icon, use the Icon property.

OnClick

Occurs when the alert has been clicked.

[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }

Property Value

EventCallback<MouseEventArgs>

RightToLeft

[CascadingParameter(Name = "RightToLeft")]
public bool RightToLeft { get; set; }

Property Value

bool

Severity

Severity of the alert.

[Parameter]
[Category("Behavior")]
public Severity Severity { get; set; }

Property Value

Severity

Remarks

The severity determines the color and icon used.

ShowCloseIcon

Displays a close icon.

[Parameter]
[Category("Behavior")]
public bool ShowCloseIcon { get; set; }

Property Value

bool

Remarks

To customize which icon is displayed for the close icon, set the CloseIcon property.

Square

Disables rounded corners.

[Parameter]
[Category("Appearance")]
public bool Square { get; set; }

Property Value

bool

Remarks

Defaults to false. Override with Rounded.

Variant

Display variant to use.

[Parameter]
[Category("Appearance")]
public Variant Variant { get; set; }

Property Value

Variant

Remarks

Defaults to Text. The variant changes the appearance of the alert, such as Text, Outlined, or Filled.

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

OnParametersSet()

protected override void OnParametersSet()

See Also