Table of Contents

Class MudToggleIconButton

Namespace
MudBlazor
Assembly
MudBlazor.dll

Represents a button consisting of an icon that can be toggled between two distinct states.

public class MudToggleIconButton : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged
Inheritance
MudToggleIconButton
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

MudToggleIconButton()

public MudToggleIconButton()

Properties

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.

Color

The color of the button.

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

Property Value

Color

Remarks

Defaults to Default in Color.

Disabled

Disables interaction with the 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.

Edge

Applies a negative margin.

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

Property Value

Edge

Remarks

Defaults to False.

Icon

The icon to use.

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

Property Value

string

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.

Size

The size of the button.

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

Property Value

Size

Remarks

Defaults to Medium.

Toggled

Whether the icon is in the toggled state.

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

Property Value

bool

ToggledChanged

Occurs when Toggled is changed.

[Parameter]
public EventCallback<bool> ToggledChanged { get; set; }

Property Value

EventCallback<bool>

ToggledColor

An alternative color to use in the toggled state.

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

Property Value

Color?

ToggledIcon

An alternative icon to use in the toggled state.

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

Property Value

string

ToggledSize

An alternative size to use in the toggled state.

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

Property Value

Size?

ToggledVariant

An alternative variant to use in the toggled state.

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

Property Value

Variant?

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

SetToggledAsync(bool)

protected Task SetToggledAsync(bool toggled)

Parameters

toggled bool

Returns

Task

Toggle()

Toggles the state of the button.

public Task Toggle()

Returns

Task

See Also