Skip to content

Interface: SuggestionMenu ​

Controller returned by createSuggestionMenu().

Properties ​

PropertyModifierTypeDescription
referencereadonlyVirtualReferenceWhere the trigger character is on screen; pass it to your positioning code.

Methods ​

dismiss() ​

ts
dismiss(): void;

Close until the user types somewhere else.

Returns ​

void


getListboxProps() ​

ts
getListboxProps(): ElementProps;

Props for the list: id, role="listbox", aria-label. Mousedown is prevented to keep focus in the editor.

Returns ​

ElementProps


getOptionProps() ​

ts
getOptionProps(id): ElementProps;

Props for an option: id, role="option", aria-selected, data-active when highlighted. Click chooses it.

Parameters ​

ParameterType
idstring

Returns ​

ElementProps


getState() ​

ts
getState(): SuggestionMenuState;

The current state; the same object until something changes.

Returns ​

SuggestionMenuState


getStatusProps() ​

ts
getStatusProps(): ElementProps;

A polite live region announcing how many options there are.

Returns ​

ElementProps


select() ​

ts
select(id): void;

Remove the typed trigger and query, run the item's command in the same undo step, and focus the editor. Does nothing for an unknown id or while closed.

Parameters ​

ParameterType
idstring

Returns ​

void


subscribe() ​

ts
subscribe(listener): () => void;

Call listener on every state change; returns the unsubscribe function.

Parameters ​

ParameterType
listener() => void

Returns ​

() => void