Skip to content

Interface: UseSuggestionMenuResult ​

Returned by useSuggestionMenu(): the controller state as fields, plus actions and prop getters.

Extends ​

Properties ​

PropertyModifierTypeDescriptionInherited from
activeIdreadonlystring | nullId of the highlighted option, or null.SuggestionMenuState.activeId
itemsreadonlyreadonly SuggestionItem[]The items for the current query. Empty while closed.SuggestionMenuState.items
loadingreadonlybooleanAn async items call is still running.SuggestionMenuState.loading
openreadonlybooleanA trigger match is active and there is at least one item.SuggestionMenuState.open
queryreadonlystringWhat was typed after the trigger character. Empty while closed.SuggestionMenuState.query
referencereadonlyVirtualReferenceWhere the trigger character is; give it to your positioning code.-
statusreadonlystringWhat the status region says, e.g. "3 suggestions". Empty while closed.SuggestionMenuState.status

Methods ​

dismiss() ​

ts
dismiss(): void;

Close until the user types somewhere else.

Returns ​

void


getListboxProps() ​

ts
getListboxProps(): ReactProps;

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

Returns ​

ReactProps


getOptionProps() ​

ts
getOptionProps(id): ReactProps;

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

Parameters ​

ParameterType
idstring

Returns ​

ReactProps


getStatusProps() ​

ts
getStatusProps(): ReactProps;

A polite live region announcing how many options there are.

Returns ​

ReactProps


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