Table of Contents

Class MudButton

Namespace
MudBlazor
Assembly
MudBlazor.dll

Represents a button for actions, links, and commands.

public class MudButton : MudBaseButton, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IDisposable
Inheritance
MudButton
Implements
Inherited Members
Extension Methods

Remarks

Creates a button element, or anchor if Href is set.
You can directly add attributes like title or aria-label.

Constructors

MudButton()

public MudButton()

Properties

ChildContent

The content within this component.

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

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Color

The color of the button.

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

Property Value

Color

Remarks

Defaults to Default in Color.

EndIcon

The icon displayed after the text.

[Parameter]
[Category("Behavior")]
public string? EndIcon { get; set; }

Property Value

string

Remarks

Defaults to null. Use StartIcon to display an icon before the text.

EndIconClass

protected string EndIconClass { get; }

Property Value

string

FullWidth

Expands the button to 100% of the container width.

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

Property Value

bool

Remarks

Defaults to false.

IconClass

The CSS classes applied to icons.

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

Property Value

string

Remarks

Defaults to null. You can use spaces to separate multiple classes.

IconColor

The color of icons.

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

Property Value

Color

Remarks

Defaults to Inherit.

IconSize

The size of icons.

[Parameter]
[Category("Appearance")]
public Size? IconSize { get; set; }

Property Value

Size?

Remarks

Defaults to null. When null, the value of Size is used.

Size

The size of the button.

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

Property Value

Size

Remarks

Defaults to Medium. Use the IconSize property to set the size of icons.

StartIcon

The icon displayed before the text.

[Parameter]
[Category("Behavior")]
public string? StartIcon { get; set; }

Property Value

string

Remarks

Defaults to null. Use EndIcon to display an icon after the text.

StartIconClass

protected string StartIconClass { get; }

Property Value

string

Variant

The display variation to use.

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

Property Value

Variant

Remarks

Defaults to Text in Variant.

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Dispose()

public void Dispose()

Dispose(bool)

Releases resources used by this button.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

OnInitialized()

protected override void OnInitialized()

See Also