Skip to content

ElectronMenuItemConstructorOptions

Unofficial

Options for constructing an Electron ElectronMenuItem.

Import:

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

Signature:

export interface ElectronMenuItemConstructorOptions

Properties

PropertyTypeDescription
accelerator?ElectronAcceleratorThe item's accelerator.
acceleratorWorksWhenHidden?booleanWhen 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?booleanShould only be specified for checkbox or radio type menu items.
enabled?booleanIf false, the menu item will be greyed out and unclickable.
icon?ElectronNativeImage | stringThe item's icon.
id?stringUnique within a single menu. If defined then it can be used as a reference to this item by the position attribute.
label?stringThe item's visible label.
registerAccelerator?booleanIf 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?ElectronSharingItemThe item to share when the role is shareMenu. darwin only.
sublabel?stringThe 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?stringHover text for this menu item. darwin only.
type?'checkbox' | 'normal' | 'radio' | 'separator' | 'submenu'The type of the item.
visible?booleanIf false, the menu item will be entirely hidden.

Methods

MethodReturnsDescription
click(menuItem, browserWindow, event)voidWill be called when the menu item is clicked.