Table of Contents

Class MudToggleItem<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll

An item as part of a MudToggleGroup<T>

public class MudToggleItem<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IDisposable

Type Parameters

T

The type of item being toggled.

Inheritance
MudToggleItem<T>
Implements
Inherited Members
Extension Methods

Constructors

MudToggleItem()

public MudToggleItem()

Properties

CheckMarkClassname

protected string CheckMarkClassname { get; }

Property Value

string

ChildContent

The custom content shown for this item.

[Parameter]
[Category("Appearance")]
public RenderFragment<bool>? ChildContent { get; set; }

Property Value

RenderFragment<bool>

Remarks

The provided boolean parameter is true when this item is selected. When set, Text will not be displayed.

Classname

protected string Classname { get; }

Property Value

string

Disabled

Prevents the user from interacting with this item.

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

Property Value

bool

Remarks

Defaults to false.

Parent

The MudToggleGroup<T> hosting this item if one exists.

[CascadingParameter]
public MudToggleGroup<T>? Parent { get; set; }

Property Value

MudToggleGroup<T>

Selected

Whether this item is currently selected.

protected bool Selected { get; }

Property Value

bool

SelectedIcon

The icon shown for the selected checkmark.

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

Property Value

string

Remarks

Defaults to Check. Applies when CheckMark is true.

Text

The text shown for this item.

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

Property Value

string

Remarks

Defaults to null. Should be set if the displayed text differs from Value?.ToString().
Only shows if ChildContent is not set.

UnselectedIcon

The icon shown for the unselected checkmark.

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

Property Value

string

Remarks

Defaults to null (no icon). Applies when CheckMark is true.

Value

The value associated with this item.

[Parameter]
[Category("Behavior")]
public T? Value { get; set; }

Property Value

T

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Dispose()

Releases resources used by this component.

public void Dispose()

Dispose(bool)

Releases resources used by this component.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

HandleOnClickAsync()

protected Task HandleOnClickAsync()

Returns

Task

OnInitialized()

protected override void OnInitialized()

SetSelected(bool)

Sets the selection state of this item.

public void SetSelected(bool selected)

Parameters

selected bool

When true, this item is selected.

See Also