Hierarchy

  • ContextMenuItem

Properties

Optional disabled

disabled: undefined | false | true

Unavailable attribute.

By default, the property’s value is false. If you need to make an item impossible to select, pass true.

Optional label

label: undefined | string

Name of the menu item.

Optional link

link: undefined | string

Link that will open upon a click on the menu element.

Optional linkTarget

linkTarget: undefined | string

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: undefined | false | true

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

  • click(): void
  • Action that is completed when the element is clicked.

    Here you can pass a function that will be executed when the menu item is clicked. For example, the onClickMenuItem function declared in scripts can be called:

    {
       label: 'Menu 2', 
       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[]>