Table of Contents

Class MudMenuItem

Namespace
MudBlazor
Assembly
MudBlazor.dll

A choice displayed as part of a list within a MudMenu component.

public class MudMenuItem : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged
Inheritance
MudMenuItem
Implements
Inherited Members
Extension Methods

Constructors

MudMenuItem()

public MudMenuItem()

Properties

ActivatesSubMenu

The menu item is acting as the activator for a sub menu.

protected bool ActivatesSubMenu { get; }

Property Value

bool

AutoClose

Closes the menu when this item is clicked.

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

Property Value

bool

Remarks

Defaults to true. When false, the menu will remain open after this item is clicked.

ChildContent

The content within this menu item.

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

Property Value

RenderFragment

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

ForceLoad

Performs a full page load during navigation.

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

Property Value

bool

Remarks

Defaults to false. When true, client-side routing is bypassed and the browser is forced to load the new page from the server.

Href

The URL to navigate to when this menu item is clicked.

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

Property Value

string

Remarks

Defaults to null. When clicked, the browser will navigate to this URL. Use the Target property to target a specific tab.

Icon

The icon displayed at the start of this menu item. The size depends on whether or not the menu is using the dense variant.

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

Property Value

string

IconColor

The color of the icon when Icon is set.

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

Property Value

Color

Remarks

Defaults to Inherit.

JsApiService

[Inject]
protected IJsApiService JsApiService { get; set; }

Property Value

IJsApiService

Label

The text shown on this menu item if ChildContent is not set.

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

Property Value

string

OnClick

Occurs when this menu item is clicked.

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

Property Value

EventCallback<MouseEventArgs>

ParentMenu

The MudMenu which contains this item.

[CascadingParameter]
public MudMenu? ParentMenu { get; set; }

Property Value

MudMenu

Target

The browser tab/window opened when a click occurs and Href is set.

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

Property Value

string

Remarks

Defaults to null. This property allows navigation to open a new tab/window or to reuse a specific tab. Possible values are _blank, _self, _parent, _top, noopener, or the name of an iframe element.

UriHelper

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

Property Value

NavigationManager

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

GetDense()

protected bool GetDense()

Returns

bool

GetDisabled()

protected bool GetDisabled()

Returns

bool

GetHtmlTag()

protected string GetHtmlTag()

Returns

string

GetTypo()

protected Typo GetTypo()

Returns

Typo

OnClickHandlerAsync(MouseEventArgs)

protected Task OnClickHandlerAsync(MouseEventArgs ev)

Parameters

ev MouseEventArgs

Returns

Task

See Also