AboutSupportDeveloper GuideVersion 36.122.80.23

Interface MenuItemTemplate<Data>

Type Parameters

  • Data extends unknown = unknown

    User-defined shape for data returned upon menu item click. Should be a union of all possible data shapes for the entire menu, and the click handler should process these with a "reducer" pattern.

Hierarchy

  • MenuItemTemplate

Properties

checked?: boolean

Should only be specified for checkbox type menu items.

data?: Data

Data to be returned if the user selects the element. Must be serializable

enabled?: boolean

If false, the menu item will be greyed out and unclickable.

icon?: string

Image Data URI with image dimensions inferred from the encoded string

label?: string

The text to show on the menu item. Should be left undefined for type: 'separator'

role?: "reload" | "cut" | "copy" | "paste" | "toggleDevTools"
submenu?: MenuItemTemplate<Data>[]

Should be specified for submenu type menu items. If submenu is specified, the type: 'submenu' can be omitted.

type?: "normal" | "separator" | "submenu" | "checkbox"

Can be normal, separator, submenu, or checkbox. Defaults to 'normal' unless a 'submenu' key exists

visible?: boolean

If false, the menu item will be entirely hidden.