Constructor
new PopupMenu()
- Implements:
- Source:
Listens to Events:
- window#event:click
- window#event:resize
- window#event:orientationchange
Example
// Display PopupMenu under the button
const myButton = document.getElementById('myButton');
const itemList = [
new PopupMenuItem(1, 'Menu item 1'),
new PopupMenuItem(2, 'Menu item 2'),
new PopupMenuItem(3, 'Menu item 3')
];
const position = PopupMenuPosition.alignBottomLeft(myButton);
const selectedId = await PopupMenu.show(itemList, position);
Methods
(static) close()
Closes any existing instance of PopupMenu on the screen
- Source:
(async, static) show(menuItems, position)
Displays the popup menu and returns the id of the selected item
asynchronously.
Example of usage:
const selectedId = await PopupMenu.show(itemsList, position);
Parameters:
Name | Type | Description |
---|---|---|
menuItems |
Array.<PopupMenuItem> | The list of items to be displayed |
position |
PopupMenuPosition | The position of PopupMenu |
- Source: