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
| Property | Type | Description | Defined in |
|---|---|---|---|
active? | (state) => boolean | A 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? | string | Optionally adds a CSS class to the item's DOM representation. | packages/menu/src/types/MenuItemSpec.ts:62 |
css? | string | Optionally adds a string of inline CSS to the item's DOM representation. | packages/menu/src/types/MenuItemSpec.ts:68 |
enable? | (state) => boolean | Function 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? | IconSpec | Describes an icon to show for this item. | packages/menu/src/types/MenuItemSpec.ts:45 |
label? | string | Makes 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) => HTMLElement | A 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) => boolean | The function to execute when the menu item is activated. | packages/menu/src/types/MenuItemSpec.ts:13 |
select? | (state) => boolean | Optional 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) => string | Defines DOM title (mouseover) text for the item. | packages/menu/src/types/MenuItemSpec.ts:57 |