Skip to content

Type Editor


Type Editor / @type-editor/menu / types/MenuItemSpec / MenuItemSpec

Interface: MenuItemSpec

Defined in: packages/menu/src/types/MenuItemSpec.ts:8

The configuration object passed to the MenuItem constructor.

Properties

PropertyTypeDescriptionDefined in
active?(state) => booleanA predicate function to determine whether the item is 'active' (for example, the item for toggling the strong mark might be active then the cursor is in strong text).packages/menu/src/types/MenuItemSpec.ts:34
class?stringOptionally adds a CSS class to the item's DOM representation.packages/menu/src/types/MenuItemSpec.ts:62
css?stringOptionally adds a string of inline CSS to the item's DOM representation.packages/menu/src/types/MenuItemSpec.ts:68
enable?(state) => booleanFunction that is used to determine if the item is enabled. If given and returning false, the item will be given a disabled styling.packages/menu/src/types/MenuItemSpec.ts:27
icon?IconSpecDescribes an icon to show for this item.packages/menu/src/types/MenuItemSpec.ts:45
label?stringMakes the item show up as a text label. Mostly useful for items wrapped in a drop-down or similar menu. The object should have a label property providing the text to display.packages/menu/src/types/MenuItemSpec.ts:52
render?(view) => HTMLElementA function that renders the item. You must provide either this, icon, or label.packages/menu/src/types/MenuItemSpec.ts:40
run(state, dispatch, view, event) => booleanThe function to execute when the menu item is activated.packages/menu/src/types/MenuItemSpec.ts:13
select?(state) => booleanOptional function that is used to determine whether the item is appropriate at the moment. Deselected items will be hidden.packages/menu/src/types/MenuItemSpec.ts:20
title?string | (state) => stringDefines DOM title (mouseover) text for the item.packages/menu/src/types/MenuItemSpec.ts:57