Skip to content

ElectronMenuItem

Unofficial

Electron MenuItem for adding items to native application menus.

Import:

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

Signature:

export class ElectronMenuItem

Properties

PropertyTypeDescription
accelerator?ElectronAcceleratorThe item's accelerator, if set.
checkedbooleanWhether the item is checked. This property can be dynamically changed.
commandIdnumberAn item's sequential unique id.
enabledbooleanWhether the item is enabled. This property can be dynamically changed.
icon?ElectronNativeImage | stringThe item's icon, if set.
idstringThe item's unique id. This property can be dynamically changed.
labelstringThe item's visible label.
menuElectronMenuThe menu that the item is a part of.
registerAcceleratorbooleanWhether the accelerator should be registered with the system or just displayed. This property can be dynamically changed.
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' | 'startSpeaking' | 'stopSpeaking' | 'toggleDevTools' | 'togglefullscreen' | 'toggleSpellChecker' | 'toggleTabBar' | 'undo' | 'unhide' | 'viewMenu' | 'window' | 'windowMenu' | 'zoom' | 'zoomIn' | 'zoomOut'The item's role, if set.
sharingItemElectronSharingItemThe item to share when the role is shareMenu. This property can be dynamically changed. darwin only.
sublabelstringThe item's sublabel.
submenu?ElectronMenuThe menu item's submenu, if present.
toolTipstringThe item's hover text. darwin only.
type'checkbox' | 'normal' | 'radio' | 'separator' | 'submenu'The type of the item.
userAcceleratorElectronAccelerator | nullThe item's user-assigned accelerator for the menu item. Only initialized after the item has been added to a menu; accessing before initialization returns null. darwin only.
visiblebooleanWhether the item is visible. This property can be dynamically changed.

Methods

MethodReturnsDescription
click(menuItem, browserWindow, event)voidThe click handler that is fired when the menu item receives a click event.

Links to this page: