MENU Property Type

Many components allow for a popup menu on right click using the menu shared property which takes an ARRAY of type MENU.

"menu": [
  {
    "text": "First item",
    "action": { ... }
  },
  {
    "type": "Separator"
  },
  {
    "text": "Second item",
    "action": { ... }
  }
]

Properties

type
ENUM
Default: "text"
Value Description
"text" Text standard text menu item.
"separator" A separator between items.
Tip

In general, there is no need to provide a type unless you want a separator. When using a separator, text and value are ignored.

text
STRING

Set the text for this menu.

state
ENUM
Default: "off"
Value Description
"off" A normal menu item with no state.
"on" A menu item with a tick.
"mixed" A menu item with a dash.

Useful for dynamically created popup menus using the popupmenu JSON Action.

submenu
ARRAY
Of type: menu

An array of menu items to provide a submenu for this item. When adding a submenu, the action is ignored.

action
ACTION | ARRAY

Which action(s) should be run when the menu item is selected, see the action object.