Menu button
Renders a menu button with nested submenus.
Node name : menu-button
Attributes
| Attribute | Type | Required | Default value | Description |
|---|---|---|---|---|
| label | string |
false |
The label to be displayed in the button. | |
| icon | string |
false |
The name of the image representing the icon in the button. | |
| items | MenuItem[] |
false |
An array of menu items. | |
| name | string |
false |
Menu name. | |
| variant | string (default, positive, primary, danger, ghost, ghost-positive, ghost-primary, ghost-danger, link) |
false |
default |
Variant. |
| size | string (extrasmall, small, medium, large, extralarge) |
false |
medium |
Size. |
| badge | string |
false |
string |
Value of the badge. |
| badge-severity | string (none, info, positive, warning, danger) |
false |
none |
Severity of the badge. |
| focused | bool |
false |
false |
Value indicating whether the component is focused. |
| animated | bool |
false |
true |
Value indicating whether the button is animated. |
MenuItem class :
| Property | Type | Required | Description |
|---|---|---|---|
| caption | string |
true |
The caption of the menu item. |
| children | MenuItem[] |
false |
The children of the menu item representing the nested submenu. |
| icon | string |
false |
The icon of the menu item. Displayed before text. |
| path | string |
false |
The path of the menu item. Path is built with the template {MenuName}/{ChildMenuItemName}/{GrandChildMenuItemName}/... A menu can display only two depth level, so if a path have a depth greater than 3 (menuName/menuHeader/menuItem/someSubMenuItem), it is necessary to navigate to the nested submenu to display the desired item. |
| parent | MenuItem |
false |
The parent of the menu item. |
| to | string |
false |
The UI view name to navigate to when the menu item is selected. |
Examples
Primary menu
<menu-button label="Menu" />
In this example, the menu button is bound to the primary menu.
Secondary menu
<menu-button label="Settings" name="Settings" />
In this example, the menu button is bound to a secondary menu named "Settings".
Computed menu
<menu-button label="Menu" items="@Computeds.MenuItems" />
The MenuItems computed has a getter with the following code:
List<MenuItem> menuItems = Application.GetMenuItems("Settings").ToList();
menuItems.Add(new MenuItem(...));
return menuItems;
In this example, the menu button is bound to a computed menu.