Blazorise ContextMenu component

Provides a contextual menu that can be opened from a right-click target or programmatically.

API

Parameters

ParameterDefaultType
ChildContentnullRenderFragment

Specifies the content to be rendered inside this ContextMenu.
CloseOnClicktruebool

Closes the menu when a regular item is clicked.
CloseOnEscapetruebool

Closes the menu when pressing the Escape key.
CloseOnOutsideClicktruebool

Closes the menu when clicking outside of it.
Disabledfalsebool

Prevents the menu from opening through its observed target.
SubmenuHoverCloseDelay300int

Delay in milliseconds before hiding a hover-opened submenu after the mouse leaves it.
SubmenuTriggerAllDropdownTrigger

Defines which pointer interactions can open or close nested submenus.
Possible values:NoneClickHoverAll
TargetId—string

Specifies an element id that opens this context menu when right-clicked.
TargetSelector—string

Specifies a CSS selector that opens this context menu when a matching element is right-clicked.
Visiblefalsebool

Gets or sets whether the menu is visible.
Setting this to true opens the menu relative to its configured target. Use Double) to open the menu at a specific viewport position.

Events

EventType
ClosedEventCallback<ContextMenuEventArgs>

Occurs after the menu closes.
ClosingFunc<ContextMenuClosingEventArgs, Task>

Callback invoked before the menu closes. Set Cancel to prevent closing.
OpenedEventCallback<ContextMenuEventArgs>

Occurs after the menu body has rendered and its initial position has been applied.
OpeningFunc<ContextMenuOpeningEventArgs, Task>

Callback invoked before the menu opens. Set Cancel to prevent opening.
VisibleChangedEventCallback<bool>

Notifies when the effective menu visibility changes or a canceled request must be synchronized.

Methods

MethodReturnParameters
HideTask—

Hides the context menu.
RepositionTask—

Repositions the visible context menu relative to its configured target.
This method does nothing while the menu is hidden and does not invoke Opening, Opened, or VisibleChanged.
RepositionTaskdouble clientX, double clientY

Repositions the visible context menu at the supplied viewport coordinates.
This method does nothing while the menu is hidden and does not invoke Opening, Opened, or VisibleChanged.
ShowTask—

Opens the context menu relative to its configured target.
This method does nothing while the menu is visible. Use Reposition to update its position.
ShowTaskdouble clientX, double clientY

Opens the context menu at the supplied viewport coordinates.
This method does nothing while the menu is visible. Use Double) to update its position.