Blazorise Context Menu API
Explore the Blazorise Context Menu API reference for parameters, events, methods, and related types.
For examples and usage guidance, see the Context Menu documentation.
API
Parameters
ContextMenu
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to be rendered inside this ContextMenu. |
RenderFragment | null |
CloseOnClick |
Closes the menu when a regular item is clicked. |
bool | true |
CloseOnEscape |
Closes the menu when pressing the Escape key. |
bool | true |
CloseOnOutsideClick |
Closes the menu when clicking outside of it. |
bool | true |
Disabled |
Prevents the menu from opening through its observed target. |
bool | false |
SubmenuHoverCloseDelay |
Delay in milliseconds before hiding a hover-opened submenu after the mouse leaves it. |
int | 300 |
SubmenuTrigger |
Defines which pointer interactions can open or close nested submenus. Possible values: |
DropdownTrigger | default(DropdownTrigger) |
TargetId |
Specifies an element id that opens this context menu when right-clicked. |
string | |
TargetSelector |
Specifies a CSS selector that opens this context menu when a matching element is right-clicked. |
string | |
Visible |
Gets or sets whether the menu is visible. RemarksSetting this to opens the menu relative to its configured target. Use Double) to open the menu at a specific viewport position. |
bool | false |
ContextMenuToggle
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to be rendered inside this ContextMenuToggle. |
RenderFragment | null |
ContextMenuBody
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to be rendered inside this ContextMenuBody. |
RenderFragment | null |
ContextMenuItem
| Parameter | Description | Type | Default |
|---|---|---|---|
Active |
Indicates the currently active item. |
bool | false |
Checked |
Tracks the checked state whenever the item is in checkbox mode. |
bool | false |
ChildContent |
Specifies the content to be rendered inside this ContextMenuItem. |
RenderFragment | null |
Disabled |
Indicates the currently disabled item. |
bool | false |
Icon |
Specifies the icon to render before the item content. |
object | null |
Shortcut |
Specifies shortcut text rendered at the end of the item. |
string | |
ShowCheckbox |
The item renders a checkbox. |
bool | false |
Value |
Holds the item value. |
object | null |
ContextMenuToolbar
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to be rendered inside this ContextMenuToolbar. |
RenderFragment | null |
ContextMenuToolbarItem
| Parameter | Description | Type | Default |
|---|---|---|---|
Active |
Indicates the currently active item. |
bool | false |
Disabled |
Indicates the currently disabled item. |
bool | false |
EndAligned |
Pushes this item and any following items to the logical end of the toolbar. |
bool | false |
Icon |
Specifies the icon to render inside the toolbar item. |
object | null |
ShowText |
Indicates whether Text should be rendered visibly next to the icon. |
bool | false |
Text |
Specifies the toolbar item text. It is used as the default title and aria-label. |
string | |
Value |
Holds the item value. |
object | null |
ContextMenuHeader
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to be rendered inside this ContextMenuHeader. |
RenderFragment | null |
ContextMenuGroup
| Parameter | Description | Type | Default |
|---|---|---|---|
CheckMode |
Defines how child items handle checked state. Possible values: |
ContextMenuCheckMode | ContextMenuCheckMode.None |
ChildContent |
Specifies the content to be rendered inside this ContextMenuGroup. |
RenderFragment | null |
SelectedValue |
Gets or sets the currently selected value when CheckMode is Radio. |
object | null |
ContextMenuSubmenu
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to be rendered inside this ContextMenuSubmenu. |
RenderFragment | null |
Disabled |
Indicates the submenu is disabled. |
bool | false |
HoverCloseDelay |
Delay in milliseconds before hiding this hover-opened submenu after the mouse leaves it. |
int? | null |
Icon |
Specifies the icon to render before the submenu label. |
object | null |
Text |
Specifies the submenu label. |
string | |
Trigger |
Defines which pointer interactions can open or close this submenu. |
DropdownTrigger? | null |
Events
ContextMenu
| Event | Description | Type |
|---|---|---|
Closed |
Occurs after the menu closes. |
EventCallback<ContextMenuEventArgs> |
Closing |
Callback invoked before the menu closes. Set Cancel to prevent closing. |
Func<ContextMenuClosingEventArgs, Task> |
Opened |
Occurs after the menu body has rendered and its initial position has been applied. |
EventCallback<ContextMenuEventArgs> |
Opening |
Callback invoked before the menu opens. Set Cancel to prevent opening. |
Func<ContextMenuOpeningEventArgs, Task> |
VisibleChanged |
Notifies when the effective menu visibility changes or a canceled request must be synchronized. |
EventCallback<bool> |
ContextMenuItem
| Event | Description | Type |
|---|---|---|
CheckedChanged |
Occurs after the checked state changes whenever the item is in checkbox mode. |
EventCallback<bool> |
Clicked |
Notifies when the item is clicked. |
EventCallback<object> |
ContextMenuToolbarItem
| Event | Description | Type |
|---|---|---|
Clicked |
Notifies when the toolbar item is clicked. |
EventCallback<object> |
ContextMenuGroup
| Event | Description | Type |
|---|---|---|
SelectedValueChanged |
Occurs after the selected value changes. |
EventCallback<object> |
Methods
ContextMenu
| Method | Description | Return | Parameters |
|---|---|---|---|
Hide |
Hides the context menu. | Task | |
Reposition |
Repositions the visible context menu relative to its configured target.
RemarksThis method does nothing while the menu is hidden and does not invoke Opening, Opened, or VisibleChanged. | Task | |
Reposition |
Repositions the visible context menu at the supplied viewport coordinates.
RemarksThis method does nothing while the menu is hidden and does not invoke Opening, Opened, or VisibleChanged. | Task | double clientX, double clientY |
Show |
Opens the context menu relative to its configured target.
RemarksThis method does nothing while the menu is visible. Use Reposition to update its position. | Task | |
Show |
Opens the context menu at the supplied viewport coordinates.
RemarksThis method does nothing while the menu is visible. Use Double) to update its position. | Task | double clientX, double clientY |