Hierarchy
- ContextMenuItem
Properties
Optional disabled
Unavailable attribute.
By default, the property’s value is false
.
If you need to make an item impossible to select, pass true
.
Optional label
Name of the menu item.
Optional link
Link that will open upon a click on the menu element.
Optional linkTarget
Attribute that determines where the link needs to be opened.
By default, the property’s value is _self
.
_blank
: the link will open in a new window or tab.
_self
: the link will open in the current window or tab.
_parent
: the link will open in the parent frame. If there are no frames, it will open as _self
.
_top
: cancels all frames and loads the page in the full browser window. If there are no frames, this value works as _self
.
Optional separator
Separator attribute.
By default, the property’s value is false
.
If you set the value to true
, the item will be a separator.
Methods
Optional click
-
Action that is completed when the element is clicked.
You can pass a function here that will be executed when a menu item is clicked. For example, clicking the menu item will call the
onClickMenuItem
function, declated in the scripts:{ label: 'Menu2', click: function () { Scripts.onClickMenuItem(); } }
Returns void
Optional getItems
-
Method for getting nested menu items of the next level when the mouse is hovered over the current item.
The function passed to this parameter must return an array of child menu elements. For example, when a user hovers overe the element, a list of chil elelemtns will open:
{ getItems: async function () { return [ { label: 'Child element 1', }, { label: 'Child element 2', }, ]; } }
Returns Promise<ContextMenuItem[]>
Drop-down menu element