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

Gets or sets the 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 it is not required.

ClassPosition

protected string ClassPosition { get; }

Property Value

string

Classname

protected string Classname { get; }

Property Value

string

CloseIcon

Gets or sets the 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

Gets or sets the 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

Gets or sets whether compact padding will be used.

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

Property Value

bool

Remarks

Defaults to false.

Elevation

Gets or sets the 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

Gets or sets the 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

Gets or sets whether no icon is displayed.

[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

Gets or sets the 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

Gets or sets whether a close icon is displayed.

[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

Gets or sets whether rounded corners are disabled.

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

Property Value

bool

Remarks

Defaults to false. Can be overridden by Rounded

Variant

Gets or sets the 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