@lexical/react/LexicalMenuOption
Classes
MenuOption
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
Properties
icon?
optionalicon?:Element
Defined in: packages/lexical-react/src/LexicalMenuOption.ts:27
key
key:
string
Defined in: packages/lexical-react/src/LexicalMenuOption.ts:25
ref?
optionalref?:RefObject<HTMLElement|null>
Defined in: packages/lexical-react/src/LexicalMenuOption.ts:26
title?
optionaltitle?: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