interface _CreateCreateProperties {
    checked?: boolean;
    command?: string;
    contexts?: browser.contextMenus._ContextType[];
    documentUrlPatterns?: string[];
    enabled?: boolean;
    icons?: browser.contextMenus._CreateCreatePropertiesIcons;
    id?: string;
    onclick?: (info: browser.contextMenus.OnClickData, tab: Tab) => void;
    parentId?: string | number;
    targetUrlPatterns?: string[];
    title?: string;
    type?: browser.contextMenus.ItemType;
    viewTypes?: ViewType[];
    visible?: boolean;
}
Index
checked?: boolean

The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items.

command?: string

Specifies a command to issue for the context click.

List of contexts this menu item will appear in. Defaults to ['page'] if not specified.

documentUrlPatterns?: string[]

Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns.

enabled?: boolean

Whether this context menu item is enabled or disabled. Defaults to true.

id?: string

The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension.

onclick?: (info: browser.contextMenus.OnClickData, tab: Tab) => void

A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for contextMenus.onClicked.

Type Declaration

    • (info: browser.contextMenus.OnClickData, tab: Tab): void
    • Parameters

      • info: browser.contextMenus.OnClickData

        Information about the item clicked and the context where the click happened.

      • tab: Tab

        The details of the tab where the click took place. Note: this parameter only present for extensions. Not supported on manifest versions above 2.

      Returns void

parentId?: string | number

The ID of a parent menu item; this makes the item a child of a previously added item.

targetUrlPatterns?: string[]

Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags.

title?: string

The text to be displayed in the item; this is required unless type is 'separator'. When the context is 'selection', you can use %s within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin".

The type of menu item. Defaults to 'normal' if not specified.

viewTypes?: ViewType[]

List of view types where the menu item will be shown. Defaults to any view, including those without a viewType.

visible?: boolean

Whether the item is visible in the menu.