menu
Enumerations
NativeIcon
A native Icon to be used for the menu item
Platform-specific:
- Windows / Linux: Unsupported.
Enumeration Members
Add
Add: "Add";
An add item template image.
Advanced
Advanced: "Advanced";
Advanced preferences toolbar icon for the preferences window.
Bluetooth
Bluetooth: "Bluetooth";
A Bluetooth template image.
Bookmarks
Bookmarks: "Bookmarks";
Bookmarks image suitable for a template.
Caution
Caution: "Caution";
A caution image.
ColorPanel
ColorPanel: "ColorPanel";
A color panel toolbar icon.
ColumnView
ColumnView: "ColumnView";
A column view mode template image.
Computer
Computer: "Computer";
A computer icon.
EnterFullScreen
EnterFullScreen: "EnterFullScreen";
An enter full-screen mode template image.
Everyone
Everyone: "Everyone";
Permissions for all users.
ExitFullScreen
ExitFullScreen: "ExitFullScreen";
An exit full-screen mode template image.
FlowView
FlowView: "FlowView";
A cover flow view mode template image.
Folder
Folder: "Folder";
A folder image.
FolderBurnable
FolderBurnable: "FolderBurnable";
A burnable folder icon.
FolderSmart
FolderSmart: "FolderSmart";
A smart folder icon.
FollowLinkFreestanding
FollowLinkFreestanding: "FollowLinkFreestanding";
A link template image.
FontPanel
FontPanel: "FontPanel";
A font panel toolbar icon.
GoLeft
GoLeft: "GoLeft";
A go back
template image.
GoRight
GoRight: "GoRight";
A go forward
template image.
Home
Home: "Home";
Home image suitable for a template.
IChatTheater
IChatTheater: "IChatTheater";
An iChat Theater template image.
IconView
IconView: "IconView";
An icon view mode template image.
Info
Info: "Info";
An information toolbar icon.
InvalidDataFreestanding
InvalidDataFreestanding: "InvalidDataFreestanding";
A template image used to denote invalid data.
LeftFacingTriangle
LeftFacingTriangle: "LeftFacingTriangle";
A generic left-facing triangle template image.
ListView
ListView: "ListView";
A list view mode template image.
LockLocked
LockLocked: "LockLocked";
A locked padlock template image.
LockUnlocked
LockUnlocked: "LockUnlocked";
An unlocked padlock template image.
MenuMixedState
MenuMixedState: "MenuMixedState";
A horizontal dash, for use in menus.
MenuOnState
MenuOnState: "MenuOnState";
A check mark template image, for use in menus.
MobileMe
MobileMe: "MobileMe";
A MobileMe icon.
MultipleDocuments
MultipleDocuments: "MultipleDocuments";
A drag image for multiple items.
Network
Network: "Network";
A network icon.
Path
Path: "Path";
A path button template image.
PreferencesGeneral
PreferencesGeneral: "PreferencesGeneral";
General preferences toolbar icon for the preferences window.
QuickLook
QuickLook: "QuickLook";
A Quick Look template image.
Refresh
Refresh: "Refresh";
A refresh template image.
RefreshFreestanding
RefreshFreestanding: "RefreshFreestanding";
A refresh template image.
Remove
Remove: "Remove";
A remove item template image.
RevealFreestanding
RevealFreestanding: "RevealFreestanding";
A reveal contents template image.
RightFacingTriangle
RightFacingTriangle: "RightFacingTriangle";
A generic right-facing triangle template image.
Share
Share: "Share";
A share view template image.
Slideshow
Slideshow: "Slideshow";
A slideshow template image.
SmartBadge
SmartBadge: "SmartBadge";
A badge for a smart
item.
StatusAvailable
StatusAvailable: "StatusAvailable";
Small green indicator, similar to iChat’s available image.
StatusNone
StatusNone: "StatusNone";
Small clear indicator.
StatusPartiallyAvailable
StatusPartiallyAvailable: "StatusPartiallyAvailable";
Small yellow indicator, similar to iChat’s idle image.
StatusUnavailable
StatusUnavailable: "StatusUnavailable";
Small red indicator, similar to iChat’s unavailable image.
StopProgress
StopProgress: "StopProgress";
A stop progress button template image.
StopProgressFreestanding
StopProgressFreestanding: "StopProgressFreestanding";
A stop progress template image.
TrashEmpty
TrashEmpty: "TrashEmpty";
An image of the empty trash can.
TrashFull
TrashFull: "TrashFull";
An image of the full trash can.
User
User: "User";
Permissions for a single user.
UserAccounts
UserAccounts: "UserAccounts";
User account toolbar icon for the preferences window.
UserGroup
UserGroup: "UserGroup";
Permissions for a group of users.
UserGuest
UserGuest: "UserGuest";
Permissions for guests.
Classes
CheckMenuItem
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.
Extends
MenuItemBase
Accessors
id
Get Signature
get id(): string
The id of this item.
Returns
string
Inherited from
MenuItemBase.id
rid
Get Signature
get rid(): number
Returns
number
Inherited from
MenuItemBase.rid
Methods
close()
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.
Returns
Promise
<void
>
Inherited from
MenuItemBase.close
isChecked()
isChecked(): Promise<boolean>
Returns whether this check menu item is checked or not.
Returns
Promise
<boolean
>
isEnabled()
isEnabled(): Promise<boolean>
Returns whether this check menu item is enabled or not.
Returns
Promise
<boolean
>
setAccelerator()
setAccelerator(accelerator): Promise<void>
Sets the accelerator for this check menu item.
Parameters
Parameter | Type |
---|---|
accelerator | null | string |
Returns
Promise
<void
>
setChecked()
setChecked(checked): Promise<void>
Sets whether this check menu item is checked or not.
Parameters
Parameter | Type |
---|---|
checked | boolean |
Returns
Promise
<void
>
setEnabled()
setEnabled(enabled): Promise<void>
Sets whether this check menu item is enabled or not.
Parameters
Parameter | Type |
---|---|
enabled | boolean |
Returns
Promise
<void
>
setText()
setText(text): Promise<void>
Sets the text for this check menu item.
Parameters
Parameter | Type |
---|---|
text | string |
Returns
Promise
<void
>
text()
text(): Promise<string>
Returns the text of this check menu item.
Returns
Promise
<string
>
new()
static new(opts): Promise<CheckMenuItem>
Create a new check menu item.
Parameters
Parameter | Type |
---|---|
opts | CheckMenuItemOptions |
Returns
IconMenuItem
An icon menu item inside a Menu
or Submenu
and usually contains an icon and a text.
Extends
MenuItemBase
Accessors
id
Get Signature
get id(): string
The id of this item.
Returns
string
Inherited from
MenuItemBase.id
rid
Get Signature
get rid(): number
Returns
number
Inherited from
MenuItemBase.rid
Methods
close()
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.
Returns
Promise
<void
>
Inherited from
MenuItemBase.close
isEnabled()
isEnabled(): Promise<boolean>
Returns whether this icon menu item is enabled or not.
Returns
Promise
<boolean
>
setAccelerator()
setAccelerator(accelerator): Promise<void>
Sets the accelerator for this icon menu item.
Parameters
Parameter | Type |
---|---|
accelerator | null | string |
Returns
Promise
<void
>
setEnabled()
setEnabled(enabled): Promise<void>
Sets whether this icon menu item is enabled or not.
Parameters
Parameter | Type |
---|---|
enabled | boolean |
Returns
Promise
<void
>
setIcon()
setIcon(icon): Promise<void>
Sets an icon for this icon menu item
Parameters
Parameter | Type |
---|---|
icon | | null | string | number [] | ArrayBuffer | Uint8Array <ArrayBufferLike > | Image |
Returns
Promise
<void
>
setText()
setText(text): Promise<void>
Sets the text for this icon menu item.
Parameters
Parameter | Type |
---|---|
text | string |
Returns
Promise
<void
>
text()
text(): Promise<string>
Returns the text of this icon menu item.
Returns
Promise
<string
>
new()
static new(opts): Promise<IconMenuItem>
Create a new icon menu item.
Parameters
Parameter | Type |
---|---|
opts | IconMenuItemOptions |
Returns
Menu
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.
Platform-specific:
Extends
MenuItemBase
Accessors
id
Get Signature
get id(): string
The id of this item.
Returns
string
Inherited from
MenuItemBase.id
rid
Get Signature
get rid(): number
Returns
number
Inherited from
MenuItemBase.rid
Methods
append()
append<T>(items): Promise<void>
Add a menu item to the end of this menu.
Platform-specific:
Type Parameters
Type Parameter |
---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Parameters
Parameter | Type |
---|---|
items | T | T [] |
Returns
Promise
<void
>
close()
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.
Returns
Promise
<void
>
Inherited from
MenuItemBase.close
get()
get(id): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>
Retrieves the menu item matching the given identifier.
Parameters
Parameter | Type |
---|---|
id | string |
Returns
Promise
<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem
>
insert()
insert<T>(items, position): Promise<void>
Add a menu item to the specified position in this menu.
Platform-specific:
Type Parameters
Type Parameter |
---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Parameters
Parameter | Type |
---|---|
items | T | T [] |
position | number |
Returns
Promise
<void
>
items()
items(): Promise<( | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem)[]>
Returns a list of menu items that has been added to this menu.
Returns
Promise
<(
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem
)[]>
popup()
popup(at?, window?): Promise<void>
Popup this menu as a context menu on the specified window.
If the position, is provided, it is relative to the window’s top-left corner.
Parameters
Parameter | Type |
---|---|
at ? | LogicalPosition | PhysicalPosition | Position |
window ? | Window |
Returns
Promise
<void
>
prepend()
prepend<T>(items): Promise<void>
Add a menu item to the beginning of this menu.
Platform-specific:
Type Parameters
Type Parameter |
---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Parameters
Parameter | Type |
---|---|
items | T | T [] |
Returns
Promise
<void
>
remove()
remove(item): Promise<void>
Remove a menu item from this menu.
Parameters
Parameter | Type |
---|---|
item | | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Returns
Promise
<void
>
removeAt()
removeAt(position): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>
Remove a menu item from this menu at the specified position.
Parameters
Parameter | Type |
---|---|
position | number |
Returns
Promise
<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem
>
setAsAppMenu()
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.
Returns
setAsWindowMenu()
setAsWindowMenu(window?): Promise<null | Menu>
Sets the window menu and returns the previous one.
Platform-specific:
- macOS: Unsupported. The menu on macOS is app-wide and not specific to one
window, if you need to set it, use
Menu.setAsAppMenu
instead.
Parameters
Parameter | Type |
---|---|
window ? | Window |
Returns
default()
static default(): Promise<Menu>
Create a default menu.
Returns
new()
static new(opts?): Promise<Menu>
Create a new menu.
Parameters
Parameter | Type |
---|---|
opts ? | MenuOptions |
Returns
MenuItem
A menu item inside a Menu
or Submenu
and contains only text.
Extends
MenuItemBase
Accessors
id
Get Signature
get id(): string
The id of this item.
Returns
string
Inherited from
MenuItemBase.id
rid
Get Signature
get rid(): number
Returns
number
Inherited from
MenuItemBase.rid
Methods
close()
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.
Returns
Promise
<void
>
Inherited from
MenuItemBase.close
isEnabled()
isEnabled(): Promise<boolean>
Returns whether this menu item is enabled or not.
Returns
Promise
<boolean
>
setAccelerator()
setAccelerator(accelerator): Promise<void>
Sets the accelerator for this menu item.
Parameters
Parameter | Type |
---|---|
accelerator | null | string |
Returns
Promise
<void
>
setEnabled()
setEnabled(enabled): Promise<void>
Sets whether this menu item is enabled or not.
Parameters
Parameter | Type |
---|---|
enabled | boolean |
Returns
Promise
<void
>
setText()
setText(text): Promise<void>
Sets the text for this menu item.
Parameters
Parameter | Type |
---|---|
text | string |
Returns
Promise
<void
>
text()
text(): Promise<string>
Returns the text of this menu item.
Returns
Promise
<string
>
new()
static new(opts): Promise<MenuItem>
Create a new menu item.
Parameters
Parameter | Type |
---|---|
opts | MenuItemOptions |
Returns
PredefinedMenuItem
A predefined (native) menu item which has a predefined behavior by the OS or by tauri.
Extends
MenuItemBase
Accessors
id
Get Signature
get id(): string
The id of this item.
Returns
string
Inherited from
MenuItemBase.id
rid
Get Signature
get rid(): number
Returns
number
Inherited from
MenuItemBase.rid
Methods
close()
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.
Returns
Promise
<void
>
Inherited from
MenuItemBase.close
setText()
setText(text): Promise<void>
Sets the text for this predefined menu item.
Parameters
Parameter | Type |
---|---|
text | string |
Returns
Promise
<void
>
text()
text(): Promise<string>
Returns the text of this predefined menu item.
Returns
Promise
<string
>
new()
static new(opts?): Promise<PredefinedMenuItem>
Create a new predefined menu item.
Parameters
Parameter | Type |
---|---|
opts ? | PredefinedMenuItemOptions |
Returns
Submenu
A type that is a submenu inside a Menu
or Submenu
.
Extends
MenuItemBase
Accessors
id
Get Signature
get id(): string
The id of this item.
Returns
string
Inherited from
MenuItemBase.id
rid
Get Signature
get rid(): number
Returns
number
Inherited from
MenuItemBase.rid
Methods
append()
append<T>(items): Promise<void>
Add a menu item to the end of this submenu.
Platform-specific:
Type Parameters
Type Parameter |
---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Parameters
Parameter | Type |
---|---|
items | T | T [] |
Returns
Promise
<void
>
close()
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.
Returns
Promise
<void
>
Inherited from
MenuItemBase.close
get()
get(id): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>
Retrieves the menu item matching the given identifier.
Parameters
Parameter | Type |
---|---|
id | string |
Returns
Promise
<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem
>
insert()
insert<T>(items, position): Promise<void>
Add a menu item to the specified position in this submenu.
Platform-specific:
Type Parameters
Type Parameter |
---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Parameters
Parameter | Type |
---|---|
items | T | T [] |
position | number |
Returns
Promise
<void
>
isEnabled()
isEnabled(): Promise<boolean>
Returns whether this submenu is enabled or not.
Returns
Promise
<boolean
>
items()
items(): Promise<( | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem)[]>
Returns a list of menu items that has been added to this submenu.
Returns
Promise
<(
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem
)[]>
popup()
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.
Parameters
Parameter | Type |
---|---|
at ? | LogicalPosition | PhysicalPosition |
window ? | Window |
Returns
Promise
<void
>
prepend()
prepend<T>(items): Promise<void>
Add a menu item to the beginning of this submenu.
Platform-specific:
Type Parameters
Type Parameter |
---|
T extends | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Parameters
Parameter | Type |
---|---|
items | T | T [] |
Returns
Promise
<void
>
remove()
remove(item): Promise<void>
Remove a menu item from this submenu.
Parameters
Parameter | Type |
---|---|
item | | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem |
Returns
Promise
<void
>
removeAt()
removeAt(position): Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu| MenuItem>
Remove a menu item from this submenu at the specified position.
Parameters
Parameter | Type |
---|---|
position | number |
Returns
Promise
<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem
>
setAsHelpMenuForNSApp()
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”.
Platform-specific:
- Windows / Linux: Unsupported.
Returns
Promise
<void
>
setAsWindowsMenuForNSApp()
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.
Platform-specific:
- Windows / Linux: Unsupported.
Returns
Promise
<void
>
setEnabled()
setEnabled(enabled): Promise<void>
Sets whether this submenu is enabled or not.
Parameters
Parameter | Type |
---|---|
enabled | boolean |
Returns
Promise
<void
>
setText()
setText(text): Promise<void>
Sets the text for this submenu.
Parameters
Parameter | Type |
---|---|
text | string |
Returns
Promise
<void
>
text()
text(): Promise<string>
Returns the text of this submenu.
Returns
Promise
<string
>
new()
static new(opts): Promise<Submenu>
Create a new submenu.
Parameters
Parameter | Type |
---|---|
opts | SubmenuOptions |
Returns
Interfaces
AboutMetadata
A metadata for the about predefined menu item.
Properties
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. |
CheckMenuItemOptions
Options for creating a new check menu item.
Extends
Properties
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 |
IconMenuItemOptions
Options for creating a new icon menu item.
Extends
Properties
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 |
MenuItemOptions
Options for creating a new menu item.
Extended by
Properties
MenuOptions
Options for creating a new menu.
Properties
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. |
PredefinedMenuItemOptions
Options for creating a new predefined menu item.
Properties
Type Aliases
SubmenuOptions
type SubmenuOptions: Omit<MenuItemOptions, "accelerator" | "action"> & MenuOptions;