Table of Contents

Class MudMenu

Namespace
MudBlazor
Assembly
MudBlazor.dll
public class MudMenu : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IActivatable
Inheritance
MudMenu
Implements
Inherited Members
Extension Methods

Constructors

MudMenu()

public MudMenu()

Properties

ActivationEvent

Specify the activation event when ActivatorContent is set

[Parameter]
[Category("Behavior")]
public MouseEvent ActivationEvent { get; set; }

Property Value

MouseEvent

ActivatorClassname

protected string ActivatorClassname { get; }

Property Value

string

ActivatorContent

Place a MudButton, a MudIconButton or any other component capable of acting as an activator. This will override the standard button and all parameters which concern it.

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

Property Value

RenderFragment

AnchorOrigin

Set the anchor origin point to determine where the popover will open from.

[Parameter]
[Category("Popup appearance")]
public Origin AnchorOrigin { get; set; }

Property Value

Origin

AriaLabel

The aria-label for the menu button when ActivatorContent is not set.

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

Property Value

string

Remarks

Defaults to null.

ChildContent

Add menu items here

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

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Color

The color of the button. It supports the theme colors.

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

Property Value

Color

Dense

If true, compact vertical padding will be applied to all menu items.

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

Property Value

bool

Disabled

If true, menu will be disabled.

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

Property Value

bool

DropShadow

Determines whether the component has a drop-shadow. Default is true

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

Property Value

bool

EndIcon

Icon placed after the text if set.

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

Property Value

string

FullWidth

If true, the list menu will be same width as the parent.

[Parameter]
[Category("Popup appearance")]
public bool FullWidth { get; set; }

Property Value

bool

Icon

Icon to use if set will turn the button into a MudIconButton.

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

Property Value

string

IconColor

The color of the icon. It supports the theme colors.

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

Property Value

Color

Label

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

Property Value

string

ListClass

User class names for the list, separated by space

[Parameter]
[Category("Popup appearance")]
public string? ListClass { get; set; }

Property Value

string

LockScroll

Set to true if you want to prevent page from scrolling when the menu is open

[Parameter]
[Category("Popup appearance")]
public bool LockScroll { get; set; }

Property Value

bool

MaxHeight

Sets the max height the menu can have when open.

[Parameter]
[Category("Popup appearance")]
public int? MaxHeight { get; set; }

Property Value

int?

Open

Gets a value indicating whether the menu is currently open or not.

public bool Open { get; }

Property Value

bool

OpenChanged

Fired when the menu Open property changes.

[Parameter]
[Category("Popup behavior")]
public EventCallback<bool> OpenChanged { get; set; }

Property Value

EventCallback<bool>

PopoverClass

User class names for the popover, separated by space

[Parameter]
[Category("Popup appearance")]
public string? PopoverClass { get; set; }

Property Value

string

PositionAtCursor

If true, instead of positioning the menu at the left upper corner, position at the exact cursor location. This makes sense for larger activators

[Parameter]
[Category("Popup behavior")]
public bool PositionAtCursor { get; set; }

Property Value

bool

Ripple

Gets or sets whether to show a ripple effect when the user clicks the button. Default is true.

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

Property Value

bool

Size

The button Size of the component.

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

Property Value

Size

StartIcon

Icon placed before the text if set.

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

Property Value

string

TransformOrigin

Sets the transform origin point for the popover.

[Parameter]
[Category("Popup appearance")]
public Origin TransformOrigin { get; set; }

Property Value

Origin

Variant

The button variant to use.

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

Property Value

Variant

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

CloseMenuAsync()

Closes the menu.

public Task CloseMenuAsync()

Returns

Task

OpenMenuAsync(EventArgs)

Opens the menu.

public Task OpenMenuAsync(EventArgs args)

Parameters

args EventArgs

The arguments of the calling mouse/pointer event. If PositionAtCursor is true, the menu will be positioned using the coordinates in this parameter.

Returns

Task

ToggleMenuAsync(EventArgs)

Toggle the visibility of the menu.

public Task ToggleMenuAsync(EventArgs args)

Parameters

args EventArgs

Returns

Task