Table of Contents

Class MudList<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll

A scrollable list for displaying text, avatars, and icons.

[CascadingTypeParameter("T")]
public class MudList<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IDisposable

Type Parameters

T

The type of item being listed.

Inheritance
MudList<T>
Implements
Inherited Members
Extension Methods

Remarks

This component contains an optional MudListSubheader and one or more MudListItem<T>.

Constructors

MudList()

public MudList()

Properties

CheckBoxColor

The color of checkboxes when SelectionMode is MultiSelection.

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

Property Value

Color

Remarks

Defaults to Default.

CheckedIcon

The icon to use for checked checkboxes when SelectionMode is MultiSelection.

[Parameter]
[Category("Selecting")]
public string CheckedIcon { get; set; }

Property Value

string

Remarks

Defaults to CheckBox.

ChildContent

The content within this list.

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

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Color

The color of the selected list item.

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

Property Value

Color

Remarks

Defaults to Primary.

Comparer

The comparer used to see if two list items are equal.

[Parameter]
[Category("Selecting")]
public IEqualityComparer<T?> Comparer { get; set; }

Property Value

IEqualityComparer<T>

Remarks

Defaults to Default.

Dense

Uses less vertical space for list items.

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

Property Value

bool

Remarks

Defaults to false.

Disabled

Prevents any list item from being clicked.

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

Property Value

bool

Remarks

Defaults to false.

Gutters

Applies left and right padding to all list items.

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

Property Value

bool

Remarks

Defaults to true.

Padding

Applies vertical padding to this list.

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

Property Value

bool

Remarks

Defaults to false.

ParentList

[CascadingParameter]
protected MudList<T>? ParentList { get; set; }

Property Value

MudList<T>

ReadOnly

Prevents list items from being selected.

[Parameter]
[Category("Selecting")]
public bool ReadOnly { get; set; }

Property Value

bool

Remarks

Defaults to false.

SelectedValue

The currently selected value.

[Parameter]
[Category("Selecting")]
public T? SelectedValue { get; set; }

Property Value

T

Remarks

This value is updated when SelectionMode is SingleSelection.

SelectedValueChanged

Occurs when SelectedValue has changed.

[Parameter]
public EventCallback<T?> SelectedValueChanged { get; set; }

Property Value

EventCallback<T>

Remarks

This event occurs when SelectionMode is SingleSelection.

SelectedValues

The currently selected values.

[Parameter]
[Category("Selecting")]
public IReadOnlyCollection<T>? SelectedValues { get; set; }

Property Value

IReadOnlyCollection<T>

Remarks

This value is updated when SelectionMode is MultiSelection.

SelectedValuesChanged

Occurs when SelectedValues has changed.

[Parameter]
public EventCallback<IReadOnlyCollection<T>?> SelectedValuesChanged { get; set; }

Property Value

EventCallback<IReadOnlyCollection<T>>

Remarks

This event occurs when SelectionMode is MultiSelection.

SelectionMode

Controls how list items are selected.

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

Property Value

SelectionMode

Remarks

Defaults to SingleSelection.
Use SingleSelection to select one list item at a time.
Use MultiSelection to allow selecting multiple list items.
Use ToggleSelection to toggle selections on and off when clicked.

UncheckedIcon

The icon to use for unchecked checkboxes when SelectionMode is MultiSelection.

[Parameter]
[Category("Selecting")]
public string UncheckedIcon { get; set; }

Property Value

string

Remarks

Defaults to CheckBoxOutlineBlank.

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Dispose()

Releases resources used by this component.

public void Dispose()

OnAfterRender(bool)

protected override void OnAfterRender(bool firstRender)

Parameters

firstRender bool

OnInitialized()

protected override void OnInitialized()

See Also