# Blazor Menu Overview

The <a href="https://www.telerik.com/blazor-ui/menu" target="_blank">Blazor Menu component</a> displays data (flat or hierarchical) in a traditional menu-like structure. In addition to built-in navigation capabilities, you can browse through the items and their children, define [templates](https://www.telerik.com/blazor-ui/documentation/components/menu/templates) for the individual nodes, render text and icons/images, and respond to [events](https://www.telerik.com/blazor-ui/documentation/components/menu/events).

## Creating Blazor Menu

1. Use the `TelerikMenu` tag to add the component to your Razor page.

2. Populate the `Data` property with the collection of items that you want to appear in the menu. The Menu will automatically recognize property names like `Id`, `ParentId`, `Text` and a few others. Otherwise, [use bindings to configure custom property names](https://www.telerik.com/blazor-ui/documentation/components/menu/data-binding/overview#data-bindings).

> caption Basic Menu with hierarchical data binding and built-in navigation

<demo metaUrl="client/menu/overview/example-1/" height="320"></demo>

## Data Binding

To show any items, the Blazor Menu requires a data source that you can provide through the `Data` property. The Menu allows you to display the items both as flat data and hierarchically. [Read more about the Blazor Menu data binding...](https://www.telerik.com/blazor-ui/documentation/components/menu/data-binding/overview)

## Navigate Views

A menu is often used to list pages, views, or sections in an application so the user can navigate through them. To do that with a menu, you have two options:

* Use the built-in `UrlField` in the [bound data](https://www.telerik.com/blazor-ui/documentation/components/menu/data-binding/overview#data-bindings) to populate the URLs in the anchors that the menu will generate if you provide a URL for the given item. This approach is demonstrated in the [Creating Blazor Menu](https://www.telerik.com/blazor-ui/documentation/components/menu/overview#creating-blazor-menu) example.
* Use a [Template](https://www.telerik.com/blazor-ui/documentation/components/menu/templates) to generate the desired links (e.g., `NavLink` components) with your own code to enable fine-tuning.

[Read more about the Blazor navigation Menu...](https://www.telerik.com/blazor-ui/documentation/components/menu/navigation)

## Orientation

The Blazor Menu allows you to control its orientation and display the items horizontally or vertically. [Read more about the Blazor Menu orientation...](https://www.telerik.com/blazor-ui/documentation/components/menu/orientation)

## Appearance

The Blazor Menu provides a `Size` parameter that controls the size of the root and popup items. [Read more about the Blazor Menu appearance settings...](https://www.telerik.com/blazor-ui/documentation/components/menu/appearance)

## Descriptions, Item Actions, and Group Headers

The Menu items can display additional content and structure:

* A description, which is a secondary line of text below the item label. Set the `DescriptionField` parameter to enable it. [Read more about Menu data bindings...](https://www.telerik.com/blazor-ui/documentation/components/menu/data-binding/overview#data-bindings)
* Trailing content, such as a keyboard shortcut, before the expand arrow. Use the `ItemActionsTemplate` to render it. [Read more about the Menu item actions template...](https://www.telerik.com/blazor-ui/documentation/components/menu/templates#itemactionstemplate)
* Group headers, which organize the child items in a popup under labeled sections. [Read more about Menu item grouping...](https://www.telerik.com/blazor-ui/documentation/components/menu/item-grouping)

## Show and Hide Behavior

By default, the Menu child items are displayed on mouse hover over the parent item and hidden on mouse leave. You can configure the Menu to [show and hide child items by clicking or tapping the parent](https://www.telerik.com/blazor-ui/documentation/components/menu/show-hide-behavior).

## Templates

You can use the functionality of the built-in templates and customize what is rendered in the items. [Read more about the Blazor Menu templates...](https://www.telerik.com/blazor-ui/documentation/components/menu/templates)

## Menu Icons

To illustrate the purpose of each menu item, the Blazor Menu allows you to add images, icon classes, or font icons. [Read more about the Blazor Menu icons...](https://www.telerik.com/blazor-ui/documentation/components/menu/icons)

## Events

The Blazor Menu generates events that you can handle and further customize its behavior. [Read more about the Blazor Menu events...](https://www.telerik.com/blazor-ui/documentation/components/menu/events)

## Menu Parameters

The following table lists Menu parameters, which are not related to other features on this page. Check the [Menu API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikmenu-1) for a full list of properties, methods, and events.

| Attribute      | Type and Default Value                              | Description                                                                                                                                                                                                                  |
| -------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Class`        | `string`                                            | Renders additional CSS class to the main wrapping element of the component. Use it to apply custom styles or [override the theme](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/override-theme-styles). |
| `CloseOnClick` | `bool`                                              | Determines whether the Menu popups should close when they are clicked.                                                                                                                                                       |
| `ShowOn`       | `MenuShowEvent` enum <br /> (`MouseEnter`)          | The browser event that will trigger child Menu items to show (mouse enter or click).                                                                                                                                         |
| `HideOn`       | `MenuHideEvent` enum <br /> (`MouseLeave`)          | The browser event that will trigger child Menu items to hide (mouse leave or click).                                                                                                                                         |
| `Size`         | `string` <br /> (`ThemeConstants.Menu.Size.Medium`) | The size of the Menu items. [Read more about the Menu appearance](https://www.telerik.com/blazor-ui/documentation/components/menu/appearance).                                                                               |

### Popup settings

The popup of the component can be additionally customized via nested tags:

<div class="skip-repl"></div>

<demo metaUrl="client/menu/overview/example-2/" height="320"></demo>

The Menu provides the following popup settings:

| Parameter             | Type                                 | Description                                                                                                                                                                                                                                   |
| --------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HorizontalCollision` | `PopupCollision` enum <br /> (`Fit`) | Sets the behavior of the Popup when it doesn't fit in the viewport based on the horizontal plane. [Read more about Popup collision behavior.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision#collision)  |
| `VerticalCollision`   | `PopupCollision` enum <br /> (`Fit`) | Defines the behavior of the Popup when it doesn't fit in the viewport based on the vertical plane. [Read more about Popup collision behavior.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision#collision) |

## Next Steps

* [Binding the Menu to Data](https://www.telerik.com/blazor-ui/documentation/components/menu/data-binding/overview)

* [Using the Menu to Navigate between Pages](https://www.telerik.com/blazor-ui/documentation/components/menu/navigation)

## See Also

* [Live Demo: Menu](https://demos.telerik.com/blazor-ui/menu/overview)
* [Menu API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikmenu-1)
