Header menu logo fable-electron-docs-api

Options Type

Constructors

Constructor Description

Options(?click, ?role, ?type, ?label, ?sublabel, ?toolTip, ?accelerator, ?icon, ?enabled, ?acceleratorWorksWhenHidden, ?visible, ?checked, ?registerAccelerator, ?sharingItem, ?submenu, ?id, ?before, ?after, ?beforeGroupContaining, ?afterGroupContaining)

Full Usage: Options(?click, ?role, ?type, ?label, ?sublabel, ?toolTip, ?accelerator, ?icon, ?enabled, ?acceleratorWorksWhenHidden, ?visible, ?checked, ?registerAccelerator, ?sharingItem, ?submenu, ?id, ?before, ?after, ?beforeGroupContaining, ?afterGroupContaining)

Parameters:
    ?click : MenuItem * Option<BaseWindow> * KeyboardEvent -> unit - Will be called with click(menuItem, window, event) when the menu item is clicked.
    ?role : Role - Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, toggleSpellChecker, togglefullscreen, window, minimize, close, help, about, services, hide, hideOthers, unhide, quit, showSubstitutions, toggleSmartQuotes, toggleSmartDashes, toggleTextReplacement, startSpeaking, stopSpeaking, zoom, front, appMenu, fileMenu, editMenu, viewMenu, shareMenu, recentDocuments, toggleTabBar, selectNextTab, selectPreviousTab, showAllTabs, mergeAllWindows, clearRecentDocuments, moveTabToNewWindow or windowMenu - Define the action of the menu item, when specified the click property will be ignored. See roles.
    ?type : Type -
    ?label : string -
    ?sublabel : string - ⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || Available in macOS >= 14.4
    ?toolTip : string - ⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || Hover text for this menu item.
    ?accelerator : string - An Accelerator string.
    ?icon : U2<NativeImage, string> -
    ?enabled : bool - If false, the menu item will be greyed out and unclickable.
    ?acceleratorWorksWhenHidden : bool - ⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || default is true, and when false will prevent the accelerator from triggering the item if the item is not visible.
    ?visible : bool - If false, the menu item will be entirely hidden.
    ?checked : bool - Should only be specified for checkbox or radio type menu items.
    ?registerAccelerator : bool - ⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌ || If false, the accelerator won't be registered with the system, but it will still be displayed. Defaults to true.
    ?sharingItem : SharingItem - ⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || The item to share when the role is shareMenu.
    ?submenu : U2<Options[], Menu> - 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.
    ?id : string - Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.
    ?before : string[] - Inserts this item before the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item.
    ?after : string[] - Inserts this item after the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu.
    ?beforeGroupContaining : string[] - Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified id.
    ?afterGroupContaining : string[] - Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified id.

Returns: Options
?click : MenuItem * Option<BaseWindow> * KeyboardEvent -> unit

Will be called with click(menuItem, window, event) when the menu item is clicked.

?role : Role

Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, toggleSpellChecker, togglefullscreen, window, minimize, close, help, about, services, hide, hideOthers, unhide, quit, showSubstitutions, toggleSmartQuotes, toggleSmartDashes, toggleTextReplacement, startSpeaking, stopSpeaking, zoom, front, appMenu, fileMenu, editMenu, viewMenu, shareMenu, recentDocuments, toggleTabBar, selectNextTab, selectPreviousTab, showAllTabs, mergeAllWindows, clearRecentDocuments, moveTabToNewWindow or windowMenu - Define the action of the menu item, when specified the click property will be ignored. See roles.

?type : Type

?label : string

?sublabel : string

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || Available in macOS >= 14.4

?toolTip : string

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || Hover text for this menu item.

?accelerator : string

An Accelerator string.

?icon : U2<NativeImage, string>

?enabled : bool

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

?acceleratorWorksWhenHidden : bool

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || default is true, and when false will prevent the accelerator from triggering the item if the item is not visible.

?visible : bool

If false, the menu item will be entirely hidden.

?checked : bool

Should only be specified for checkbox or radio type menu items.

?registerAccelerator : bool

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌ || If false, the accelerator won't be registered with the system, but it will still be displayed. Defaults to true.

?sharingItem : SharingItem

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || The item to share when the role is shareMenu.

?submenu : U2<Options[], Menu>

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.

?id : string

Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.

?before : string[]

Inserts this item before the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item.

?after : string[]

Inserts this item after the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu.

?beforeGroupContaining : string[]

Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified id.

?afterGroupContaining : string[]

Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified id.

Returns: Options

Instance members

Instance member Description

this.accelerator

Full Usage: this.accelerator

An Accelerator string.

this.acceleratorWorksWhenHidden

Full Usage: this.acceleratorWorksWhenHidden

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ default is true, and when false will prevent the accelerator from triggering the item if the item is not visible.

this.after

Full Usage: this.after

Inserts this item after the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu.

this.afterGroupContaining

Full Usage: this.afterGroupContaining

Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified id.

this.before

Full Usage: this.before

Inserts this item before the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item.

this.beforeGroupContaining

Full Usage: this.beforeGroupContaining

Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified id.

this.checked

Full Usage: this.checked

Should only be specified for checkbox or radio type menu items.

this.click

Full Usage: this.click

Will be called with click(menuItem, window, event) when the menu item is clicked.

this.enabled

Full Usage: this.enabled

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

this.icon

Full Usage: this.icon

this.id

Full Usage: this.id

Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.

this.label

Full Usage: this.label

this.registerAccelerator

Full Usage: this.registerAccelerator

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌ If false, the accelerator won't be registered with the system, but it will still be displayed. Defaults to true.

this.role

Full Usage: this.role

Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, toggleSpellChecker, togglefullscreen, window, minimize, close, help, about, services, hide, hideOthers, unhide, quit, showSubstitutions, toggleSmartQuotes, toggleSmartDashes, toggleTextReplacement, startSpeaking, stopSpeaking, zoom, front, appMenu, fileMenu, editMenu, viewMenu, shareMenu, recentDocuments, toggleTabBar, selectNextTab, selectPreviousTab, showAllTabs, mergeAllWindows, clearRecentDocuments, moveTabToNewWindow or windowMenu - Define the action of the menu item, when specified the click property will be ignored. See roles.

this.sharingItem

Full Usage: this.sharingItem

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ The item to share when the role is shareMenu.

this.sublabel

Full Usage: this.sublabel

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Available in macOS >= 14.4

this.submenu

Full Usage: this.submenu

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.

this.toolTip

Full Usage: this.toolTip

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Hover text for this menu item.

this.type

Full Usage: this.type

this.visible

Full Usage: this.visible

If false, the menu item will be entirely hidden.

Type something to start searching.