Skip to main content

@lexical/react/LexicalMenuOption

Classes

Defined in: packages/lexical-react/src/LexicalMenuOption.ts:24

The base class for an item shown in a LexicalTypeaheadMenuPlugin or LexicalNodeMenuPlugin menu. Each option has a unique key and a ref to its rendered element (used for scrolling and keyboard navigation). Subclass it to attach your own data such as a label or callback.

Its own module, and not shared/LexicalMenu, because that module is not an entry point: it is inlined into every entry that reaches it, which would give each of them a different MenuOption class. Its own module rather than one of the plugin entry points, because those export React components — anything importing this from one of them sits behind that component's Fast Refresh boundary and is invalidated whenever the component changes.

Extended by

Constructors

Constructor

new MenuOption(key): MenuOption

Defined in: packages/lexical-react/src/LexicalMenuOption.ts:30

Parameters
key

string

Returns

MenuOption

Properties

icon?

optional icon?: Element

Defined in: packages/lexical-react/src/LexicalMenuOption.ts:27

key

key: string

Defined in: packages/lexical-react/src/LexicalMenuOption.ts:25

ref?

optional ref?: RefObject<HTMLElement | null>

Defined in: packages/lexical-react/src/LexicalMenuOption.ts:26

title?

optional title?: string | Element

Defined in: packages/lexical-react/src/LexicalMenuOption.ts:28

Methods

setRefElement()

setRefElement(element): void

Defined in: packages/lexical-react/src/LexicalMenuOption.ts:36

Parameters
element

HTMLElement | null

Returns

void