Table of Contents

Class MudListItem<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll

An item within a MudList<T> component.

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

Type Parameters

T

The type of item being listed.

Inheritance
MudListItem<T>
Implements
Inherited Members
Extension Methods

Constructors

MudListItem()

public MudListItem()

Properties

AvatarContent

The custom MudAvatar to display to the left of Text.

[Parameter]
[Category("Appearance")]
public RenderFragment? AvatarContent { get; set; }

Property Value

RenderFragment

Remarks

When a value is set, Icon is ignored.

ChildContent

Display content of this list item. If set, this overrides Text

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

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Dense

Uses less vertical padding between items.

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

Property Value

bool?

Remarks

Defaults to false.

Disabled

Prevents this list item from being clicked.

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

Property Value

bool

Remarks

Defaults to false. This value can be overridden by Disabled.

ExpandIconColor

The color of the ExpandLessIcon and ExpandMoreIcon icons.

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

Property Value

Color

Remarks

Defaults to Default.

ExpandLessIcon

The icon displayed when Expanded is true.

[Parameter]
[Category("Expanding")]
public string ExpandLessIcon { get; set; }

Property Value

string

Remarks

Defaults to ExpandLess.

ExpandMoreIcon

The icon displayed when Expanded is false.

[Parameter]
[Category("Expanding")]
public string ExpandMoreIcon { get; set; }

Property Value

string

Remarks

Defaults to ExpandMore.

Expanded

Expand or collapse nested list. Two-way bindable. Note: if you directly set this to true or false (instead of using two-way binding) it will initialize the nested list's expansion state.

[Parameter]
[Category("Expanding")]
public bool Expanded { get; set; }

Property Value

bool

ExpandedChanged

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

Property Value

EventCallback<bool>

ForceLoad

Causes a full page refresh when this list item is clicked and Href is set.

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

Property Value

bool

Remarks

Defaults to false. When true, bypasses client-side routing and forces the browser to load the new page from the server, whether or not the URI would normally be handled by the client-side router. See: NavigateTo(string, bool, bool)

Gutters

Applies left and right padding to this list items.

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

Property Value

bool?

Remarks

Defaults to the value of the parent Gutters. When set, it overrides the list's setting.

Href

The URL to navigate to upon click.

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

Property Value

string

Icon

The icon to display for this list item.

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

Property Value

string

Remarks

When AvatarContent is set, this property is ignored.

IconColor

The color of the Icon.

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

Property Value

Color

Remarks

Defaults to Inherit. When AvatarContent is set, this property is ignored.

IconSize

The size of the Icon.

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

Property Value

Size

Remarks

Defaults to Medium. When AvatarContent is set, this property is ignored.

Inset

Applies an indent to this list item.

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

Property Value

bool

MudList

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

Property Value

MudList<T>

NestedList

Add child list items here to create a nested list.

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

Property Value

RenderFragment

OnClick

List click event. Also called when Href is set

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

Property Value

EventCallback<MouseEventArgs>

OnClickPreventDefault

If set, clicking the list item will only execute the OnClick handler and prevent all other functionality such as following Href or selection.

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

Property Value

bool

Ripple

Shows a ripple effect when this item is clicked.

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

Property Value

bool

Remarks

Defaults to true.

SecondaryText

The secondary text displayed.

[Parameter]
[Category("Behavior")]
public string? SecondaryText { get; set; }

Property Value

string

Remarks

This text is displayed under Text, in a smaller size.

Target

The browser frame to open this link when Href is specified.

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

Property Value

string

Remarks

Possible values include _blank, _self, _parent, _top, or a frame name.
Defaults to null.

Text

The text to display.

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

Property Value

string

UriHelper

[Inject]
protected NavigationManager UriHelper { get; set; }

Property Value

NavigationManager

Value

The value associated with this item.

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

Property Value

T

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Dispose()

public void Dispose()

OnClickHandlerAsync(MouseEventArgs)

protected Task OnClickHandlerAsync(MouseEventArgs eventArgs)

Parameters

eventArgs MouseEventArgs

Returns

Task

OnInitializedAsync()

protected override Task OnInitializedAsync()

Returns

Task

See Also