Table of Contents

Class MudToggleGroup<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll
[CascadingTypeParameter("T")]
public class MudToggleGroup<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged

Type Parameters

T
Inheritance
MudToggleGroup<T>
Implements
Inherited Members
Extension Methods

Constructors

MudToggleGroup()

public MudToggleGroup()

Properties

CheckMark

If true, the items show a check mark next to the text or render fragment. Customize the check mark by setting SelectedIcon and UnselectedIcon.

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

Property Value

bool

CheckMarkClass

Classes (separated by space) to be applied to SelectedIcon/UnselectedIcon of the items (if CheckMark is true).

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

Property Value

string

ChildContent

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

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Color

The color of the component. Affects borders and selection color. Default is Colors.Primary.

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

Property Value

Color

Delimiters

If true, show a line delimiter between items. Default is true.

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

Property Value

bool

Disabled

If true, the group will be disabled.

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

Property Value

bool

FixedContent

If true, the check mark is counter balanced with padding on the right side which makes the content stay always centered no matter if the check mark is shown or not.

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

Property Value

bool

Outlined

If true, show an outline border. Default is true.

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

Property Value

bool

RightToLeft

[CascadingParameter(Name = "RightToLeft")]
public bool RightToLeft { get; set; }

Property Value

bool

Ripple

Gets or sets whether to show a ripple effect when the user clicks the button. Default is true.

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

Property Value

bool

SelectedClass

Classes (separated by space) to be applied to the selected items only.

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

Property Value

string

SelectionMode

The selection behavior of the group. SingleSelection (the default) is a radio-button like exclusive collection. MultiSelection behaves like a group of check boxes. ToggleSelection is an exclusive single selection where you can also select nothing by toggling off the current choice.

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

Property Value

SelectionMode

Size

The size of the items in the toggle group.

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

Property Value

Size

Stylename

protected string Stylename { get; }

Property Value

string

Value

The selected value in single- and toggle-selection mode.

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

Property Value

T

ValueChanged

Fires when Value changes.

[Parameter]
[Category("Behavior")]
public EventCallback<T?> ValueChanged { get; set; }

Property Value

EventCallback<T>

Values

The selected values for multi-selection mode.

[Parameter]
[Category("Behavior")]
public IEnumerable<T?>? Values { get; set; }

Property Value

IEnumerable<T>

ValuesChanged

Fires when Values change.

[Parameter]
[Category("Behavior")]
public EventCallback<IEnumerable<T?>?> ValuesChanged { get; set; }

Property Value

EventCallback<IEnumerable<T>>

Vertical

If true, use vertical layout.

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

Property Value

bool

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

DeselectAllItems()

protected void DeselectAllItems()

GetItems()

protected IEnumerable<MudToggleItem<T>> GetItems()

Returns

IEnumerable<MudToggleItem<T>>

IsFirstItem(MudToggleItem<T>)

protected bool IsFirstItem(MudToggleItem<T> item)

Parameters

item MudToggleItem<T>

Returns

bool

IsLastItem(MudToggleItem<T>)

protected bool IsLastItem(MudToggleItem<T> item)

Parameters

item MudToggleItem<T>

Returns

bool

OnAfterRender(bool)

protected override void OnAfterRender(bool firstRender)

Parameters

firstRender bool

OnInitialized()

protected override void OnInitialized()

Register(MudToggleItem<T>)

protected void Register(MudToggleItem<T> item)

Parameters

item MudToggleItem<T>

ToggleItemAsync(MudToggleItem<T>)

protected Task ToggleItemAsync(MudToggleItem<T> item)

Parameters

item MudToggleItem<T>

Returns

Task

Unregister(MudToggleItem<T>)

protected void Unregister(MudToggleItem<T> item)

Parameters

item MudToggleItem<T>