Table of Contents

Class TwSubmenu

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

An item in a TwMenu or TwContextMenu that opens a further menu beside it, such as "Share" opening a list of places to share to. Put the same items in it as in a menu, including further submenus.

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

Remarks

The item follows the ARIA menu pattern for submenus: it says that it opens a menu and whether that menu is open. Hovering the item, clicking it, or pressing Enter, Space or Arrow Right on it opens the submenu; Arrow Right and Enter also move focus to its first item. Arrow Left or Escape close the submenu and return focus to the item. Arrow Right and Arrow Left swap in a right to left layout, where the submenu opens on the left. Choosing an action in the submenu closes the whole menu.

Constructors

TwSubmenu()

public TwSubmenu()

Properties

ChildContent

Gets or sets the submenu's items.

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

Property Value

RenderFragment

Disabled

Whether the item is disabled. It is skipped by the arrow keys and its submenu cannot open.

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

Property Value

bool

Inset

Whether the item's text is indented to line up with items that have an icon or a tick.

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

Property Value

bool

Label

Gets or sets the text of the item that opens the submenu. Also names the submenu for assistive technology.

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

Property Value

string

LabelContent

Gets or sets the content of the item that opens the submenu, in place of Label. Keep it to text.

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

Property Value

RenderFragment

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