Creating a menu

To create a new menu, you have to use the createMenu() method as shown in the below example:

The Navigation menu item

Navigation menu items open pages automatically. These menu items cannot have event handlers added to them manually, they are added automatically. Creating a navigation menu item, which will open the specified page (that has “targetPageId” as its ID) when clicked on:

Custom menu items

Custom menu items have their own custom click event handlers. These menu items do not have the page opener event handlers added to them. Thus, if you want to open a page with a custom menu item, the menu item’s event handler must have these implemented. Creating a custom menu item with a custom event that will run the myMenuAction event when clicked:

Adding a predefined menu to the MenuBar

Adding a menu element dynamically to an existing menu in the MenuBar

It is possible to dynamically expand the menu hierarchy on an already displayed MenuBar.

Supported events:

Show, Hide, Animations, Drag&Drop

Style customization

This component does not have specific variables to use for style customization. However, you can use custom style classes and Bootstrap variables to change the appearance of this component.

Related pages