Blazorise ContextMenu component
Provides a contextual menu that can be opened from a right-click target or programmatically.
API
Parameters
| Parameter | Default | Type |
|---|---|---|
ChildContent | null | RenderFragment |
Specifies the content to be rendered inside this ContextMenu. | ||
CloseOnClick | true | bool |
Closes the menu when a regular item is clicked. | ||
CloseOnEscape | true | bool |
Closes the menu when pressing the Escape key. | ||
CloseOnOutsideClick | true | bool |
Closes the menu when clicking outside of it. | ||
Disabled | false | bool |
Prevents the menu from opening through its observed target. | ||
SubmenuHoverCloseDelay | 300 | int |
Delay in milliseconds before hiding a hover-opened submenu after the mouse leaves it. | ||
SubmenuTrigger | All | DropdownTrigger |
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. | ||
Visible | false | bool |
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
| Event | Type |
|---|---|
Closed | EventCallback<ContextMenuEventArgs> |
Occurs after the menu closes. | |
Closing | Func<ContextMenuClosingEventArgs, Task> |
Callback invoked before the menu closes. Set Cancel to prevent closing. | |
Opened | EventCallback<ContextMenuEventArgs> |
Occurs after the menu body has rendered and its initial position has been applied. | |
Opening | Func<ContextMenuOpeningEventArgs, Task> |
Callback invoked before the menu opens. Set Cancel to prevent opening. | |
VisibleChanged | EventCallback<bool> |
Notifies when the effective menu visibility changes or a canceled request must be synchronized. | |
Methods
| Method | Return | Parameters |
|---|---|---|
Hide | Task | — |
Hides the context menu.
| ||
Reposition | Task | — |
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. | ||
Reposition | Task | double 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. | ||
Show | Task | — |
Opens the context menu relative to its configured target.
This method does nothing while the menu is visible. Use Reposition to update its position. | ||
Show | Task | double 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. | ||