MenuItem
Defined in: obsidian.d.ts:2660
Properties
callback()?
optional
callback: () =>void
Defined in: src/obsidian/augmentations/MenuItem.d.ts:8
The callback that is executed when the menu item is clicked
Returns
void
checked
checked:
null
|boolean
Defined in: src/obsidian/augmentations/MenuItem.d.ts:12
Whether the menu item is checked
checkIconEl?
optional
checkIconEl:HTMLElement
Defined in: src/obsidian/augmentations/MenuItem.d.ts:16
Check icon element of the menu item, only present if the item is checked
disabled
disabled:
boolean
Defined in: src/obsidian/augmentations/MenuItem.d.ts:20
Whether the menu item is disabled
dom
dom:
HTMLElement
Defined in: src/obsidian/augmentations/MenuItem.d.ts:24
Dom element of the menu item
iconEl
iconEl:
HTMLElement
Defined in: src/obsidian/augmentations/MenuItem.d.ts:28
Icon element of the menu item
menu
menu:
Menu
Defined in: src/obsidian/augmentations/MenuItem.d.ts:32
Menu the item is in
section
section:
string
Defined in: src/obsidian/augmentations/MenuItem.d.ts:36
The section the item belongs to
submenu
submenu:
null
|Menu
Defined in: src/obsidian/augmentations/MenuItem.d.ts:40
The submenu that is attached to the item
titleEl
titleEl:
HTMLElement
Defined in: src/obsidian/augmentations/MenuItem.d.ts:44
Title of the menu item
Methods
onClick()
onClick(
callback
):this
Defined in: obsidian.d.ts:2695
Parameters
callback
(evt
) => any
Returns
this
setChecked()
setChecked(
checked
):this
Defined in: obsidian.d.ts:2681
Parameters
checked
null
| boolean
Returns
this
setDisabled()
setDisabled(
disabled
):this
Defined in: obsidian.d.ts:2685
Parameters
disabled
boolean
Returns
this
setIcon()
setIcon(
icon
):this
Defined in: obsidian.d.ts:2676
Parameters
icon
ID of the icon, can use any icon loaded with addIcon or from the built-in lucide library.
null
| string
Returns
this
See
The Obsidian icon library includes the Lucide icon library, any icon name from their site will work here.
setIsLabel()
setIsLabel(
isLabel
):this
Defined in: obsidian.d.ts:2690
Parameters
isLabel
boolean
Returns
this
setSection()
setSection(
section
):this
Defined in: obsidian.d.ts:2703
Sets the section this menu item should belong in.
To find the section IDs of an existing menu, inspect the DOM elements
to see their data-section
attribute.
Parameters
section
string
Returns
this
setSubmenu()
setSubmenu():
Menu
Defined in: src/obsidian/augmentations/MenuItem.d.ts:64
Create a submenu on the menu item
Returns
setTitle()
setTitle(
title
):this
Defined in: obsidian.d.ts:2670
Parameters
title
string
| DocumentFragment
Returns
this