Table of Contents

Class TwMenuItem

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

An action in a TwMenu. Choosing it runs OnClick and closes the menu.

public class TwMenuItem : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
Inheritance
TwMenuItem
Implements
Inherited Members

Constructors

TwMenuItem()

public TwMenuItem()

Properties

ChildContent

Gets or sets the item's content, in place of Label. Keep it to text: an item is a single control, so it cannot hold links or buttons of its own.

[Parameter]
public RenderFragment? ChildContent { get; set; }

Property Value

RenderFragment

CloseOnClick

Whether choosing the item closes the menu and returns focus to its button. Defaults to true.

[Parameter]
public bool CloseOnClick { get; set; }

Property Value

bool

Disabled

Whether the item is disabled. It is skipped by the arrow keys and cannot be chosen.

[Parameter]
public bool Disabled { get; set; }

Property Value

bool

Label

Gets or sets the item's text. Use ChildContent instead for richer content.

[Parameter]
public string? Label { get; set; }

Property Value

string

OnClick

Raised when a person chooses the item, by clicking it or pressing Enter or Space on it.

[Parameter]
public EventCallback OnClick { get; set; }

Property Value

EventCallback

StartIcon

Gets or sets an icon shown before the item's text.

[Parameter]
public Icon? StartIcon { get; set; }

Property Value

Icon?

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder