跳转到内容
Tauri

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.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L19

Advanced
Advanced: "Advanced";

Advanced preferences toolbar icon for the preferences window.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L21

Bluetooth
Bluetooth: "Bluetooth";

A Bluetooth template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L23

Bookmarks
Bookmarks: "Bookmarks";

Bookmarks image suitable for a template.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L25

Caution
Caution: "Caution";

A caution image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L27

ColorPanel
ColorPanel: "ColorPanel";

A color panel toolbar icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L29

ColumnView
ColumnView: "ColumnView";

A column view mode template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L31

Computer
Computer: "Computer";

A computer icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L33

EnterFullScreen
EnterFullScreen: "EnterFullScreen";

An enter full-screen mode template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L35

Everyone
Everyone: "Everyone";

Permissions for all users.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L37

ExitFullScreen
ExitFullScreen: "ExitFullScreen";

An exit full-screen mode template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L39

FlowView
FlowView: "FlowView";

A cover flow view mode template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L41

Folder
Folder: "Folder";

A folder image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L43

FolderBurnable
FolderBurnable: "FolderBurnable";

A burnable folder icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L45

FolderSmart
FolderSmart: "FolderSmart";

A smart folder icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L47

FollowLinkFreestanding
FollowLinkFreestanding: "FollowLinkFreestanding";

A link template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L49

FontPanel
FontPanel: "FontPanel";

A font panel toolbar icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L51

GoLeft
GoLeft: "GoLeft";

A go back template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L53

GoRight
GoRight: "GoRight";

A go forward template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L55

Home
Home: "Home";

Home image suitable for a template.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L57

IChatTheater
IChatTheater: "IChatTheater";

An iChat Theater template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L59

IconView
IconView: "IconView";

An icon view mode template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L61

Info
Info: "Info";

An information toolbar icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L63

InvalidDataFreestanding
InvalidDataFreestanding: "InvalidDataFreestanding";

A template image used to denote invalid data.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L65

LeftFacingTriangle
LeftFacingTriangle: "LeftFacingTriangle";

A generic left-facing triangle template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L67

ListView
ListView: "ListView";

A list view mode template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L69

LockLocked
LockLocked: "LockLocked";

A locked padlock template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L71

LockUnlocked
LockUnlocked: "LockUnlocked";

An unlocked padlock template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L73

MenuMixedState: "MenuMixedState";

A horizontal dash, for use in menus.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L75

MenuOnState: "MenuOnState";

A check mark template image, for use in menus.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L77

MobileMe
MobileMe: "MobileMe";

A MobileMe icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L79

MultipleDocuments
MultipleDocuments: "MultipleDocuments";

A drag image for multiple items.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L81

Network
Network: "Network";

A network icon.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L83

Path
Path: "Path";

A path button template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L85

PreferencesGeneral
PreferencesGeneral: "PreferencesGeneral";

General preferences toolbar icon for the preferences window.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L87

QuickLook
QuickLook: "QuickLook";

A Quick Look template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L89

Refresh
Refresh: "Refresh";

A refresh template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L93

RefreshFreestanding
RefreshFreestanding: "RefreshFreestanding";

A refresh template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L91

Remove
Remove: "Remove";

A remove item template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L95

RevealFreestanding
RevealFreestanding: "RevealFreestanding";

A reveal contents template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L97

RightFacingTriangle
RightFacingTriangle: "RightFacingTriangle";

A generic right-facing triangle template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L99

Share
Share: "Share";

A share view template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L101

Slideshow
Slideshow: "Slideshow";

A slideshow template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L103

SmartBadge
SmartBadge: "SmartBadge";

A badge for a smart item.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L105

StatusAvailable
StatusAvailable: "StatusAvailable";

Small green indicator, similar to iChat’s available image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L107

StatusNone
StatusNone: "StatusNone";

Small clear indicator.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L109

StatusPartiallyAvailable
StatusPartiallyAvailable: "StatusPartiallyAvailable";

Small yellow indicator, similar to iChat’s idle image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L111

StatusUnavailable
StatusUnavailable: "StatusUnavailable";

Small red indicator, similar to iChat’s unavailable image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L113

StopProgress
StopProgress: "StopProgress";

A stop progress button template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L117

StopProgressFreestanding
StopProgressFreestanding: "StopProgressFreestanding";

A stop progress template image.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L115

TrashEmpty
TrashEmpty: "TrashEmpty";

An image of the empty trash can.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L119

TrashFull
TrashFull: "TrashFull";

An image of the full trash can.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L121

User
User: "User";

Permissions for a single user.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L123

UserAccounts
UserAccounts: "UserAccounts";

User account toolbar icon for the preferences window.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L125

UserGroup
UserGroup: "UserGroup";

Permissions for a group of users.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L127

UserGuest
UserGuest: "UserGuest";

Permissions for guests.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L129

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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/base.ts#L128

rid
Get Signature
get rid(): number
Returns

number

Inherited from

MenuItemBase.rid

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L297

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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L309

isChecked()
isChecked(): Promise<boolean>

Returns whether this check menu item is checked or not.

Returns

Promise<boolean>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L71

isEnabled()
isEnabled(): Promise<boolean>

Returns whether this check menu item is enabled or not.

Returns

Promise<boolean>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L48

setAccelerator()
setAccelerator(accelerator): Promise<void>

Sets the accelerator for this check menu item.

Parameters
ParameterType
acceleratornull | string
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L62

setChecked()
setChecked(checked): Promise<void>

Sets whether this check menu item is checked or not.

Parameters
ParameterType
checkedboolean
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L76

setEnabled()
setEnabled(enabled): Promise<void>

Sets whether this check menu item is enabled or not.

Parameters
ParameterType
enabledboolean
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L53

setText()
setText(text): Promise<void>

Sets the text for this check menu item.

Parameters
ParameterType
textstring
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L39

text()
text(): Promise<string>

Returns the text of this check menu item.

Returns

Promise<string>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L34

new()
static new(opts): Promise<CheckMenuItem>

Create a new check menu item.

Parameters
ParameterType
optsCheckMenuItemOptions
Returns

Promise<CheckMenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L27


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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/base.ts#L128

rid
Get Signature
get rid(): number
Returns

number

Inherited from

MenuItemBase.rid

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L297

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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L309

isEnabled()
isEnabled(): Promise<boolean>

Returns whether this icon menu item is enabled or not.

Returns

Promise<boolean>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L177

setAccelerator()
setAccelerator(accelerator): Promise<void>

Sets the accelerator for this icon menu item.

Parameters
ParameterType
acceleratornull | string
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L191

setEnabled()
setEnabled(enabled): Promise<void>

Sets whether this icon menu item is enabled or not.

Parameters
ParameterType
enabledboolean
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L182

setIcon()
setIcon(icon): Promise<void>

Sets an icon for this icon menu item

Parameters
ParameterType
icon| null | string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Image
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L200

setText()
setText(text): Promise<void>

Sets the text for this icon menu item.

Parameters
ParameterType
textstring
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L168

text()
text(): Promise<string>

Returns the text of this icon menu item.

Returns

Promise<string>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L163

new()
static new(opts): Promise<IconMenuItem>

Create a new icon menu item.

Parameters
ParameterType
optsIconMenuItemOptions
Returns

Promise<IconMenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L158


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:

  • macOS: if using Menu for the global menubar, it can only contain Submenus.

Extends

  • MenuItemBase

Accessors

id
Get Signature
get id(): string

The id of this item.

Returns

string

Inherited from

MenuItemBase.id

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/base.ts#L128

rid
Get Signature
get rid(): number
Returns

number

Inherited from

MenuItemBase.rid

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L297

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
ParameterType
itemsT | T[]
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L73

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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L309

get()
get(id): Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>

Retrieves the menu item matching the given identifier.

Parameters
ParameterType
idstring
Returns

Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L196

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
ParameterType
itemsT | T[]
positionnumber
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L131

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)[]>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L184

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
ParameterType
at?LogicalPosition | PhysicalPosition | Position
window?Window
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L218

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
ParameterType
itemsT | T[]
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L102

remove()
remove(item): Promise<void>

Remove a menu item from this menu.

Parameters
ParameterType
item| CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L155

removeAt()
removeAt(position): Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>

Remove a menu item from this menu at the specified position.

Parameters
ParameterType
positionnumber
Returns

Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L166

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

Promise<null | Menu>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L236

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
ParameterType
window?Window
Returns

Promise<null | Menu>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L250

default()
static default(): Promise<Menu>

Create a default menu.

Returns

Promise<Menu>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L60

new()
static new(opts?): Promise<Menu>

Create a new menu.

Parameters
ParameterType
opts?MenuOptions
Returns

Promise<Menu>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L55


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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/base.ts#L128

rid
Get Signature
get rid(): number
Returns

number

Inherited from

MenuItemBase.rid

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L297

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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L309

isEnabled()
isEnabled(): Promise<boolean>

Returns whether this menu item is enabled or not.

Returns

Promise<boolean>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L49

setAccelerator()
setAccelerator(accelerator): Promise<void>

Sets the accelerator for this menu item.

Parameters
ParameterType
acceleratornull | string
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L63

setEnabled()
setEnabled(enabled): Promise<void>

Sets whether this menu item is enabled or not.

Parameters
ParameterType
enabledboolean
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L54

setText()
setText(text): Promise<void>

Sets the text for this menu item.

Parameters
ParameterType
textstring
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L40

text()
text(): Promise<string>

Returns the text of this menu item.

Returns

Promise<string>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L35

new()
static new(opts): Promise<MenuItem>

Create a new menu item.

Parameters
ParameterType
optsMenuItemOptions
Returns

Promise<MenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L30


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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/base.ts#L128

rid
Get Signature
get rid(): number
Returns

number

Inherited from

MenuItemBase.rid

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L297

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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L309

setText()
setText(text): Promise<void>

Sets the text for this predefined menu item.

Parameters
ParameterType
textstring
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L132

text()
text(): Promise<string>

Returns the text of this predefined menu item.

Returns

Promise<string>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L127

new()
static new(opts?): Promise<PredefinedMenuItem>

Create a new predefined menu item.

Parameters
ParameterType
opts?PredefinedMenuItemOptions
Returns

Promise<PredefinedMenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L118


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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/base.ts#L128

rid
Get Signature
get rid(): number
Returns

number

Inherited from

MenuItemBase.rid

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L297

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
ParameterType
itemsT | T[]
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L99

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

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L309

get()
get(id): Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>

Retrieves the menu item matching the given identifier.

Parameters
ParameterType
idstring
Returns

Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L222

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
ParameterType
itemsT | T[]
positionnumber
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L157

isEnabled()
isEnabled(): Promise<boolean>

Returns whether this submenu is enabled or not.

Returns

Promise<boolean>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L79

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)[]>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L210

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
ParameterType
at?LogicalPosition | PhysicalPosition
window?Window
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L244

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
ParameterType
itemsT | T[]
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L128

remove()
remove(item): Promise<void>

Remove a menu item from this submenu.

Parameters
ParameterType
item| CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L181

removeAt()
removeAt(position): Promise<
| null
| CheckMenuItem
| IconMenuItem
| PredefinedMenuItem
| Submenu
| MenuItem>

Remove a menu item from this submenu at the specified position.

Parameters
ParameterType
positionnumber
Returns

Promise< | null | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L192

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>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L284

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>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L266

setEnabled()
setEnabled(enabled): Promise<void>

Sets whether this submenu is enabled or not.

Parameters
ParameterType
enabledboolean
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L84

setText()
setText(text): Promise<void>

Sets the text for this submenu.

Parameters
ParameterType
textstring
Returns

Promise<void>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L70

text()
text(): Promise<string>

Returns the text of this submenu.

Returns

Promise<string>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L65

new()
static new(opts): Promise<Submenu>

Create a new submenu.

Parameters
ParameterType
optsSubmenuOptions
Returns

Promise<Submenu>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L60

Interfaces

AboutMetadata

A metadata for the about predefined menu item.

Properties

PropertyTypeDescriptionDefined in
authors?string[]The authors of the application. #### Platform-specific - macOS: Unsupported.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L30
comments?stringApplication comments. #### Platform-specific - macOS: Unsupported.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L38
copyright?stringThe copyright of the application.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L40
credits?stringThe credits. #### Platform-specific - Windows / Linux: Unsupported.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L72
icon?| string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | ImageThe application icon. #### Platform-specific - Windows: Unsupported.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L80
license?stringThe license of the application. #### Platform-specific - macOS: Unsupported.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L48
name?stringSets the application name.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L12
shortVersion?stringThe short version, e.g. “1.0”. #### Platform-specific - Windows / Linux: Appended to the end of version in parentheses.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L22
version?stringThe application version.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L14
website?stringThe application website. #### Platform-specific - macOS: Unsupported.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L56
websiteLabel?stringThe website label. #### Platform-specific - macOS: Unsupported.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L64

CheckMenuItemOptions

Options for creating a new check menu item.

Extends

Properties

PropertyTypeDescriptionInherited fromDefined in
accelerator?stringSpecify an accelerator for the new menu item.MenuItemOptions.acceleratorSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L17
action?(id: string) => voidSpecify a handler to be called when this menu item is activated.MenuItemOptions.actionSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L19
checked?booleanWhether the new check menu item is enabled or not.-Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/checkMenuItem.ts#L12
enabled?booleanWhether the new menu item is enabled or not.MenuItemOptions.enabledSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L15
id?stringSpecify an id to use for the new menu item.MenuItemOptions.idSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L11
textstringThe text of the new menu item.MenuItemOptions.textSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L13

IconMenuItemOptions

Options for creating a new icon menu item.

Extends

Properties

PropertyTypeDescriptionInherited fromDefined in
accelerator?stringSpecify an accelerator for the new menu item.MenuItemOptions.acceleratorSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L17
action?(id: string) => voidSpecify a handler to be called when this menu item is activated.MenuItemOptions.actionSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L19
enabled?booleanWhether the new menu item is enabled or not.MenuItemOptions.enabledSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L15
icon?| string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | ImageIcon to be used for the new icon menu item. Note that you may need the image-ico or image-png Cargo features to use this API. To enable it, change your Cargo.toml file: [dependencies] tauri = { version = "...", features = ["...", "image-png"] }-Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/iconMenuItem.ts#L144
id?stringSpecify an id to use for the new menu item.MenuItemOptions.idSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L11
textstringThe text of the new menu item.MenuItemOptions.textSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L13

Options for creating a new menu item.

Extended by

Properties

PropertyTypeDescriptionDefined in
accelerator?stringSpecify an accelerator for the new menu item.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L17
action?(id: string) => voidSpecify a handler to be called when this menu item is activated.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L19
enabled?booleanWhether the new menu item is enabled or not.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L15
id?stringSpecify an id to use for the new menu item.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L11
textstringThe text of the new menu item.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menuItem.ts#L13

Options for creating a new menu.

Properties

PropertyTypeDescriptionDefined in
id?stringSpecify an id to use for the new menu.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L25
items?( | CheckMenuItemOptions | MenuItemOptions | CheckMenuItem | SubmenuOptions | PredefinedMenuItemOptions | IconMenuItemOptions | IconMenuItem | PredefinedMenuItem | Submenu | MenuItem)[]List of items to add to the new menu.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/menu.ts#L27

PredefinedMenuItemOptions

Options for creating a new predefined menu item.

Properties

PropertyTypeDescriptionDefined in
item| object | "Separator" | "Copy" | "Cut" | "Paste" | "SelectAll" | "Undo" | "Redo" | "Minimize" | "Maximize" | "Fullscreen" | "Hide" | "HideOthers" | "ShowAll" | "CloseWindow" | "Quit" | "Services"The predefined item typeSource: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L88
text?stringThe text of the new predefined menu item.Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/predefinedMenuItem.ts#L86

Type Aliases

type SubmenuOptions: Omit<MenuItemOptions, "accelerator" | "action"> & MenuOptions;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/menu/submenu.ts#L49


© 2024 Tauri Contributors. CC-BY / MIT