Docs (4.0.0)
class GlobalContext method

showModalMenuAsync

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

showModalMenuAsync(config: ConfigOptions.Arg<UITheme.MenuOptions>, ref?: {
    lastRenderOutput?: RenderContext.Output;
}): Promise<string | undefined>

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 component, an instance of UIComponent, e.g. a button that was clicked by the user.

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

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

Parameters

  • config — An instance of UITheme.MenuOptions, including a list of menu items; or a callback function to set options for the menu to be displayed
  • ref — The related UI component

Return value

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

Errors

  • This method throws an error if the theme modal menu controller can’t be initialized (i.e. there’s no current theme, or the theme doesn’t support modal menu views).

Related