Our Blazor Menu component allows you to add an adaptive menu to your Blazor application. Menu items are stored in the Items collection. Each item is a DxMenuItem object that can display a text, an icon, or both.
The Menu's default orientation is Horizontal (menu items are arranged in a row). Use the Orientation property to change the orientation. This demo demonstrates how to create a vertical menu.
The Menu component supports different display modes (the DisplayMode property):
Auto - the menu is adapted to the device type.
Desktop - the menu is shown as a panel with root items. The menu view also depends on the orientation. In the horizontal orientation, child items are available in drop-down menus. In the vertical orientation, submenus with child items are shown to the side of the menu container.
Mobile - the menu has a compact view and depends on the orientation. In the horizontal orientation, it is a hamburger menu. In the vertical orientation, the menu looks like a desktop menu - a panel with root items, but submenus are shown in the main menu container and have the Back button.
This demo demonstrates how to create a horizontal menu for mobile devices.
The Menu component supports adaptive mode. The following properties specify how the menu responds when the width of the browser window changes and there is not enough space to display all the items:
The Menu component allows you to use templates to customize the layout and appearance of menu items and their parts.
Use the following properties to specify common templates for all items:
Use the following properties to specify templates for an individual item:
Note that individual templates override common templates.
The following example demonstrates how to use templates to create the Search and User Profile menu items.