Documentation

showModalMenuAsync()

Displays a context/dropdown menu with the provided list of items.

showModalMenuAsync(
config: ModalMenuOptions | ((opts: ModalMenuOptions) => void),
ref?: {
lastRenderOutput?: RenderContext.Output;
},
): Promise<unknown>;

Summary

This method displays a modal menu, using the specified options (or options that are set in a configuration function). The menu is positioned near a particular UI element, an instance of UIElement, e.g. a button that was clicked by the user.

The value property of the chosen menu item, if any, is returned asynchronously. If the menu was dismissed, the returned promise is resolved to undefined.

Note
Use fmt to translate item text if necessary; this method doesn’t localize strings by default.

Parameters

Return value

A promise that resolves to the selected item value, if any

Errors

This method throws an error if the modal menu controller can’t be initialized (i.e. there’s no modal factory or menu builder).

Related