Table of Contents

Class MudBaseButton

Namespace
MudBlazor
Assembly
MudBlazor.dll

Represents a base class for designing button components.

public abstract class MudBaseButton : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged
Inheritance
MudBaseButton
Implements
Derived
Inherited Members
Extension Methods

Constructors

MudBaseButton()

protected MudBaseButton()

Fields

_elementReference

protected ElementReference _elementReference

Field Value

ElementReference

Properties

Activatable

The custom activation behavior.

[CascadingParameter]
protected IActivatable? Activatable { get; set; }

Property Value

IActivatable

Remarks

Default to null. This property is used to implement a custom behavior beyond a basic button click. The activation will occur during the OnClick event.

ButtonType

The type of button.

[Parameter]
[Category("Click action")]
public ButtonType ButtonType { get; set; }

Property Value

ButtonType

Remarks

Defaults to Button. Other values are Submit to submit a form, and Reset to clear a form.

ClickPropagation

Allows the click event to bubble up to the parent component.

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

Property Value

bool

Remarks

Defaults to false.

Disabled

Allows the user to interact with this button.

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

Property Value

bool

Remarks

Defaults to false.

DropShadow

Displays a shadow.

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

Property Value

bool

Remarks

Defaults to true.

Href

The URL to navigate to when the button is clicked.

[Parameter]
[Category("Click action")]
public string? Href { get; set; }

Property Value

string

Remarks

Defaults to null. When clicked, the browser will navigate to this URL. Use the Target property to target a specific tab.

HtmlTag

The HTML tag rendered for this component.

[Parameter]
[Category("Click action")]
public string HtmlTag { get; set; }

Property Value

string

Remarks

Defaults to button, or a if Href is set.

OnClick

Occurs when this button has been clicked.

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

Property Value

EventCallback<MouseEventArgs>

Rel

The relationship between the current document and the linked document when Href is set.

[Parameter]
[Category("Click action")]
public string? Rel { get; set; }

Property Value

string

Remarks

This property is typically used by web crawlers to get more information about a link. Common values can be found here: https://www.w3schools.com/tags/att_a_rel.asp

Ripple

Shows a ripple effect when the user clicks the button.

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

Property Value

bool

Remarks

Defaults to true.

Target

The browser tab/window opened when a click occurs and Href is set.

[Parameter]
[Category("Click action")]
public string? Target { get; set; }

Property Value

string

Remarks

Defaults to null. This property allows navigation to open a new tab/window or to reuse a specific tab. Possible values are _blank, _self, _parent, _top, noopener, or the name of an iframe element.

Methods

FocusAsync()

Obtains focus for this button.

public ValueTask FocusAsync()

Returns

ValueTask

GetClickPropagation()

protected bool GetClickPropagation()

Returns

bool

GetDisabledState()

protected bool GetDisabledState()

Returns

bool

GetRel()

protected string? GetRel()

Returns

string

OnClickHandler(MouseEventArgs)

protected virtual Task OnClickHandler(MouseEventArgs ev)

Parameters

ev MouseEventArgs

Returns

Task

OnInitialized()

protected override void OnInitialized()

OnParametersSet()

protected override void OnParametersSet()