Skip to content

ElectronMenuItemConstructorOptions

Unofficial

Options for constructing an Electron ElectronMenuItem.

Import:

import type { ElectronMenuItemConstructorOptions } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface ElectronMenuItemConstructorOptions

Properties

Property Type Description
accelerator? ElectronAccelerator The item's accelerator.
acceleratorWorksWhenHidden? boolean When false, prevents the accelerator from triggering the item if the item is not visible. darwin only.
after? string[] Inserts this item after the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu.
afterGroupContaining? string[] Declares the placement of this item's containing group after the containing group of the item with the specified label.
before? string[] Inserts this item before the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the item should be placed in the same group as the referenced item.
beforeGroupContaining? string[] Declares the placement of this item's containing group before the containing group of the item with the specified label.
checked? boolean Should only be specified for checkbox or radio type menu items.
enabled? boolean If false, the menu item will be greyed out and unclickable.
icon? ElectronNativeImage | string The item's icon.
id? string Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.
label? string The item's visible label.
registerAccelerator? boolean If false, the accelerator won't be registered with the system, but it will still be displayed. linux/win32 only.
role? 'about' | 'appMenu' | 'clearRecentDocuments' | 'close' | 'copy' | 'cut' | 'delete' | 'editMenu' | 'fileMenu' | 'forceReload' | 'front' | 'help' | 'hide' | 'hideOthers' | 'mergeAllWindows' | 'minimize' | 'moveTabToNewWindow' | 'paste' | 'pasteAndMatchStyle' | 'quit' | 'recentDocuments' | 'redo' | 'reload' | 'resetZoom' | 'selectAll' | 'selectNextTab' | 'selectPreviousTab' | 'services' | 'shareMenu' | 'showSubstitutions' | 'startSpeaking' | 'stopSpeaking' | 'toggleDevTools' | 'togglefullscreen' | 'toggleSmartDashes' | 'toggleSmartQuotes' | 'toggleSpellChecker' | 'toggleTabBar' | 'toggleTextReplacement' | 'undo' | 'unhide' | 'viewMenu' | 'window' | 'windowMenu' | 'zoom' | 'zoomIn' | 'zoomOut' Defines the action of the menu item. When specified the click property will be ignored.
sharingItem? ElectronSharingItem The item to share when the role is shareMenu. darwin only.
sublabel? string The item's sublabel.
submenu? ElectronMenu | ElectronMenuItemConstructorOptions[] Should be specified for submenu type menu items. If submenu is specified, the type: 'submenu' can be omitted. If the value is not a menu then it will be automatically converted to one using Menu.buildFromTemplate.
toolTip? string Hover text for this menu item. darwin only.
type? 'checkbox' | 'normal' | 'radio' | 'separator' | 'submenu' The type of the item.
visible? boolean If false, the menu item will be entirely hidden.

Methods

Method Returns Description
click(menuItem, browserWindow, event) void Will be called when the menu item is clicked.