menu
A native Icon to be used for the menu item
- Windows / Linux: Unsupported.
Add: "Add";An add item template image.
Advanced: "Advanced";Advanced preferences toolbar icon for the preferences window.
Bluetooth: "Bluetooth";A Bluetooth template image.
Bookmarks: "Bookmarks";Bookmarks image suitable for a template.
Caution: "Caution";A caution image.
ColorPanel: "ColorPanel";A color panel toolbar icon.
ColumnView: "ColumnView";A column view mode template image.
Computer: "Computer";A computer icon.
EnterFullScreen: "EnterFullScreen";An enter full-screen mode template image.
Everyone: "Everyone";Permissions for all users.
ExitFullScreen: "ExitFullScreen";An exit full-screen mode template image.
FlowView: "FlowView";A cover flow view mode template image.
Folder: "Folder";A folder image.
FolderBurnable: "FolderBurnable";A burnable folder icon.
FolderSmart: "FolderSmart";A smart folder icon.
FollowLinkFreestanding: "FollowLinkFreestanding";A link template image.
FontPanel: "FontPanel";A font panel toolbar icon.
GoLeft: "GoLeft";A go back template image.
GoRight: "GoRight";A go forward template image.
Home: "Home";Home image suitable for a template.
IChatTheater: "IChatTheater";An iChat Theater template image.
IconView: "IconView";An icon view mode template image.
Info: "Info";An information toolbar icon.
InvalidDataFreestanding: "InvalidDataFreestanding";A template image used to denote invalid data.
LeftFacingTriangle: "LeftFacingTriangle";A generic left-facing triangle template image.
ListView: "ListView";A list view mode template image.
LockLocked: "LockLocked";A locked padlock template image.
LockUnlocked: "LockUnlocked";An unlocked padlock template image.
MenuMixedState: "MenuMixedState";A horizontal dash, for use in menus.
MenuOnState: "MenuOnState";A check mark template image, for use in menus.
MobileMe: "MobileMe";A MobileMe icon.
MultipleDocuments: "MultipleDocuments";A drag image for multiple items.
Network: "Network";A network icon.
Path: "Path";A path button template image.
PreferencesGeneral: "PreferencesGeneral";General preferences toolbar icon for the preferences window.
QuickLook: "QuickLook";A Quick Look template image.
Refresh: "Refresh";A refresh template image.
RefreshFreestanding: "RefreshFreestanding";A refresh template image.
Remove: "Remove";A remove item template image.
RevealFreestanding: "RevealFreestanding";A reveal contents template image.
RightFacingTriangle: "RightFacingTriangle";A generic right-facing triangle template image.
Share: "Share";A share view template image.
Slideshow: "Slideshow";A slideshow template image.
SmartBadge: "SmartBadge";A badge for a smart item.
StatusAvailable: "StatusAvailable";Small green indicator, similar to iChat’s available image.
StatusNone: "StatusNone";Small clear indicator.
StatusPartiallyAvailable: "StatusPartiallyAvailable";Small yellow indicator, similar to iChat’s idle image.
StatusUnavailable: "StatusUnavailable";Small red indicator, similar to iChat’s unavailable image.
StopProgress: "StopProgress";A stop progress button template image.
StopProgressFreestanding: "StopProgressFreestanding";A stop progress template image.
TrashEmpty: "TrashEmpty";An image of the empty trash can.
TrashFull: "TrashFull";An image of the full trash can.
User: "User";Permissions for a single user.
UserAccounts: "UserAccounts";User account toolbar icon for the preferences window.
UserGroup: "UserGroup";Permissions for a group of users.
UserGuest: "UserGuest";Permissions for guests.
A check menu item inside a Menu or Submenu
and usually contains a text and a check mark or a similar toggle
that corresponds to a checked and unchecked states.
MenuItemBase
get id(): stringThe id of this item.
string
MenuItemBase.id
get rid(): numbernumber
MenuItemBase.rid
close(): Promise<void>Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.
Promise<void>
MenuItemBase.close
isChecked(): Promise<boolean>Returns whether this check menu item is checked or not.
Promise<boolean>
isEnabled(): Promise<boolean>Returns whether this check menu item is enabled or not.
Promise<boolean>
setAccelerator(accelerator): Promise<void>Sets the accelerator for this check menu item.
| Parameter | Type |
|---|---|
accelerator | null | string |
Promise<void>
setChecked(checked): Promise<void>Sets whether this check menu item is checked or not.
| Parameter | Type |
|---|---|
checked | boolean |
Promise<void>
setEnabled(enabled): Promise<void>Sets whether this check menu item is enabled or not.
| Parameter | Type |
|---|---|
enabled | boolean |
Promise<void>
setText(text): Promise<void>Sets the text for this check menu item.
| Parameter | Type |
|---|---|
text | string |
Promise<void>
text(): Promise<string>Returns the text of this check menu item.
Promise<string>
static new(opts): Promise<CheckMenuItem>Create a new check menu item.
| Parameter | Type |
|---|---|
opts | CheckMenuItemOptions |
An icon menu item inside a Menu or Submenu
and usually contains an icon and a text.
MenuItemBase
get id(): stringThe id of this item.
string
MenuItemBase.id
get rid(): numbernumber
MenuItemBase.rid
close(): Promise<void>Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.
Promise<void>
MenuItemBase.close
isEnabled(): Promise<boolean>Returns whether this icon menu item is enabled or not.
Promise<boolean>
setAccelerator(accelerator): Promise<void>Sets the accelerator for this icon menu item.
| Parameter | Type |
|---|---|
accelerator | null | string |
Promise<void>
setEnabled(enabled): Promise<void>Sets whether this icon menu item is enabled or not.
| Parameter | Type |
|---|---|
enabled | boolean |
Promise<void>
setIcon(icon): Promise<void>Sets an icon for this icon menu item
| Parameter | Type |
|---|---|
icon | | null | string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Image |
Promise<void>
setText(text): Promise<void>Sets the text for this icon menu item.
| Parameter | Type |
|---|---|
text | string |
Promise<void>
text(): Promise<string>Returns the text of this icon menu item.
Promise<string>
static new(opts): Promise<IconMenuItem>Create a new icon menu item.
| Parameter | Type |
|---|---|
opts | IconMenuItemOptions |
A type that is either a menu bar on the window on Windows and Linux or as a global menu in the menubar on macOS.
MenuItemBase
get id(): stringThe id of this item.
string
MenuItemBase.id
get rid(): numbernumber
MenuItemBase.rid
append<T>(items): Promise<void>Add a menu item to the end of this menu.
| Type Parameter |
|---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
| Parameter | Type |
|---|---|
items | T | T[] |
Promise<void>
close(): Promise<void>Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.
Promise<void>
MenuItemBase.close
get(id): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>Retrieves the menu item matching the given identifier.
| Parameter | Type |
|---|---|
id | string |
Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>
insert<T>(items, position): Promise<void>Add a menu item to the specified position in this menu.
| Type Parameter |
|---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
| Parameter | Type |
|---|---|
items | T | T[] |
position | number |
Promise<void>
items(): Promise<( | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem)[]>Returns a list of menu items that has been added to this menu.
Promise<(
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem)[]>
popup(at?, window?): Promise<void>Popup this menu as a context menu on the specified window.
| Parameter | Type | Description |
|---|---|---|
at? | LogicalPosition | PhysicalPosition | Position | If a position is provided, it is relative to the window’s top-left corner. If there isn’t one provided, the menu will pop up at the current location of the mouse. |
window? | Window | - |
Promise<void>
prepend<T>(items): Promise<void>Add a menu item to the beginning of this menu.
| Type Parameter |
|---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
| Parameter | Type |
|---|---|
items | T | T[] |
Promise<void>
remove(item): Promise<void>Remove a menu item from this menu.
| Parameter | Type |
|---|---|
item | | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Promise<void>
removeAt(position): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>Remove a menu item from this menu at the specified position.
| Parameter | Type |
|---|---|
position | number |
Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>
setAsAppMenu(): Promise<null | Menu>Sets the app-wide menu and returns the previous one.
If a window was not created with an explicit menu or had one set explicitly, this menu will be assigned to it.
setAsWindowMenu(window?): Promise<null | Menu>Sets the window menu and returns the previous one.
- macOS: Unsupported. The menu on macOS is app-wide and not specific to one
window, if you need to set it, use
Menu.setAsAppMenuinstead.
| Parameter | Type |
|---|---|
window? | Window |
static default(): Promise<Menu>Create a default menu.
static new(opts?): Promise<Menu>Create a new menu.
| Parameter | Type |
|---|---|
opts? | MenuOptions |
A menu item inside a Menu or Submenu and contains only text.
MenuItemBase
get id(): stringThe id of this item.
string
MenuItemBase.id
get rid(): numbernumber
MenuItemBase.rid
close(): Promise<void>Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.
Promise<void>
MenuItemBase.close
isEnabled(): Promise<boolean>Returns whether this menu item is enabled or not.
Promise<boolean>
setAccelerator(accelerator): Promise<void>Sets the accelerator for this menu item.
| Parameter | Type |
|---|---|
accelerator | null | string |
Promise<void>
setEnabled(enabled): Promise<void>Sets whether this menu item is enabled or not.
| Parameter | Type |
|---|---|
enabled | boolean |
Promise<void>
setText(text): Promise<void>Sets the text for this menu item.
| Parameter | Type |
|---|---|
text | string |
Promise<void>
text(): Promise<string>Returns the text of this menu item.
Promise<string>
static new(opts): Promise<MenuItem>Create a new menu item.
| Parameter | Type |
|---|---|
opts | MenuItemOptions |
A predefined (native) menu item which has a predefined behavior by the OS or by tauri.
MenuItemBase
get id(): stringThe id of this item.
string
MenuItemBase.id
get rid(): numbernumber
MenuItemBase.rid
close(): Promise<void>Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.
Promise<void>
MenuItemBase.close
setText(text): Promise<void>Sets the text for this predefined menu item.
| Parameter | Type |
|---|---|
text | string |
Promise<void>
text(): Promise<string>Returns the text of this predefined menu item.
Promise<string>
static new(opts?): Promise<PredefinedMenuItem>Create a new predefined menu item.
| Parameter | Type |
|---|---|
opts? | PredefinedMenuItemOptions |
A type that is a submenu inside a Menu or Submenu.
MenuItemBase
get id(): stringThe id of this item.
string
MenuItemBase.id
get rid(): numbernumber
MenuItemBase.rid
append<T>(items): Promise<void>Add a menu item to the end of this submenu.
| Type Parameter |
|---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
| Parameter | Type |
|---|---|
items | T | T[] |
Promise<void>
close(): Promise<void>Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.
Promise<void>
MenuItemBase.close
get(id): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>Retrieves the menu item matching the given identifier.
| Parameter | Type |
|---|---|
id | string |
Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>
insert<T>(items, position): Promise<void>Add a menu item to the specified position in this submenu.
| Type Parameter |
|---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
| Parameter | Type |
|---|---|
items | T | T[] |
position | number |
Promise<void>
isEnabled(): Promise<boolean>Returns whether this submenu is enabled or not.
Promise<boolean>
items(): Promise<( | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem)[]>Returns a list of menu items that has been added to this submenu.
Promise<(
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem)[]>
popup(at?, window?): Promise<void>Popup this submenu as a context menu on the specified window.
If the position, is provided, it is relative to the window’s top-left corner.
| Parameter | Type |
|---|---|
at? | LogicalPosition | PhysicalPosition |
window? | Window |
Promise<void>
prepend<T>(items): Promise<void>Add a menu item to the beginning of this submenu.
| Type Parameter |
|---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
| Parameter | Type |
|---|---|
items | T | T[] |
Promise<void>
remove(item): Promise<void>Remove a menu item from this submenu.
| Parameter | Type |
|---|---|
item | | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Promise<void>
removeAt(position): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>Remove a menu item from this submenu at the specified position.
| Parameter | Type |
|---|---|
position | number |
Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>
setAsHelpMenuForNSApp(): Promise<void>Set this submenu as the Help menu for the application on macOS.
This will cause macOS to automatically add a search box to the menu.
If no menu is set as the Help menu, macOS will automatically use any menu which has a title matching the localized word “Help”.
- Windows / Linux: Unsupported.
Promise<void>
setAsWindowsMenuForNSApp(): Promise<void>Set this submenu as the Window menu for the application on macOS.
This will cause macOS to automatically add window-switching items and certain other items to the menu.
- Windows / Linux: Unsupported.
Promise<void>
setEnabled(enabled): Promise<void>Sets whether this submenu is enabled or not.
| Parameter | Type |
|---|---|
enabled | boolean |
Promise<void>
setText(text): Promise<void>Sets the text for this submenu.
| Parameter | Type |
|---|---|
text | string |
Promise<void>
text(): Promise<string>Returns the text of this submenu.
Promise<string>
static new(opts): Promise<Submenu>Create a new submenu.
| Parameter | Type |
|---|---|
opts | SubmenuOptions |
A metadata for the about predefined menu item.
| Property | Type | Description | Defined in |
|---|---|---|---|
authors? | string[] | The authors of the application. #### Platform-specific - macOS: Unsupported. | |
comments? | string | Application comments. #### Platform-specific - macOS: Unsupported. | |
copyright? | string | The copyright of the application. | |
credits? | string | The credits. #### Platform-specific - Windows / Linux: Unsupported. | |
icon? | | string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Image | The application icon. #### Platform-specific - Windows: Unsupported. | |
license? | string | The license of the application. #### Platform-specific - macOS: Unsupported. | |
name? | string | Sets the application name. | |
shortVersion? | string | The short version, e.g. “1.0”. #### Platform-specific - Windows / Linux: Appended to the end of version in parentheses. | |
version? | string | The application version. | |
website? | string | The application website. #### Platform-specific - macOS: Unsupported. | |
websiteLabel? | string | The website label. #### Platform-specific - macOS: Unsupported. |
Options for creating a new check menu item.
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
accelerator? | string | Specify an accelerator for the new menu item. | MenuItemOptions.accelerator | |
action? | (id: string) => void | Specify a handler to be called when this menu item is activated. | MenuItemOptions.action | |
checked? | boolean | Whether the new check menu item is enabled or not. | - | |
enabled? | boolean | Whether the new menu item is enabled or not. | MenuItemOptions.enabled | |
id? | string | Specify an id to use for the new menu item. | MenuItemOptions.id | |
text | string | The text of the new menu item. | MenuItemOptions.text |
Options for creating a new icon menu item.
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
accelerator? | string | Specify an accelerator for the new menu item. | MenuItemOptions.accelerator | |
action? | (id: string) => void | Specify a handler to be called when this menu item is activated. | MenuItemOptions.action | |
enabled? | boolean | Whether the new menu item is enabled or not. | MenuItemOptions.enabled | |
icon? | | string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Image | Icon to be used for the new icon menu item. | - | |
id? | string | Specify an id to use for the new menu item. | MenuItemOptions.id | |
text | string | The text of the new menu item. | MenuItemOptions.text |
Options for creating a new menu item.
Options for creating a new menu.
| Property | Type | Description | Defined in |
|---|---|---|---|
id? | string | Specify an id to use for the new menu. | |
items? | ( | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem)[] | List of items to add to the new menu. |
Options for creating a new predefined menu item.
type SubmenuOptions: Omit<MenuItemOptions, "accelerator" | "action"> & MenuOptions;