Overview

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.

Use the ItemsPosition property to align items in the menu. To customize item content and appearance, use the Text, IconCssClass, CssClass properties.

Orientation

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.

Mobile Horizontal 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.




Mobile Vertical Menu

This demo demonstrates how to create a vertical menu for mobile devices. The DisplayMode property is set to Mobile, the Orientation property is set to Vertical.

Adaptivity

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:

Templates

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.