# Templates

The Kendo UI for Angular Menu enables you to customize items, links, trailing actions, group headers, and submenu content with templates.

## Item Template

To set a template for all Menu items, add an `<ng-template>` tag with the [`kendoMenuItemTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/itemtemplatedirective) directive inside the Menu component.

The following example demonstrates how to display an icon next to the text of a Menu item.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/templates/item-template/source.txt)

To set a template for specific items, [nest the template in a `<kendo-menu-item>` component](https://www.telerik.com/kendo-angular-ui-develop/components/menus/menu/items#using-templates) or [set the template](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/menuitem#template) field of the item.

The following example demonstrates how to set templates to the items.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/templates/specific-item-template/source.txt)

## Link Template

Link templates are rendered instead of the default item links and represent the entire content of an item.

To set a template for specific items, [nest the link template in the `<kendo-menu-item>` component](https://www.telerik.com/kendo-angular-ui-develop/components/menus/menu/items#using-templates).

To set a link template for all Menu items, nest an `<ng-template>` tag with the [`kendoMenuItemLinkTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/itemlinktemplatedirective) directive in the `<kendo-menu>` component.

> When you use the link template, the `text`, `url`, `icon`, and `template` options of the [items](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/menuitem) are not automatically rendered.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/templates/link-template/source.txt)

## Item Actions Template

To add trailing content after the item text, apply the [`kendoMenuItemActionsTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/itemactionstemplatedirective) directive to an `<ng-template>` tag. Use it for keyboard shortcut hints, badges, or status indicators. Both `item` and `index` are available in the template context.

A [link template](https://www.telerik.com/kendo-angular-ui-develop/components/menus/menu/templates#link-template) replaces the entire item link, so the Menu does not automatically render the actions template within it.

To apply a common actions template to all items, nest the `<ng-template>` tag inside `<kendo-menu>`.
To customize one item, nest the `<ng-template>` tag inside `<kendo-menu-item>` or assign a `TemplateRef` to the `MenuItem` object's [`actionsTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/menuitem#actionsTemplate) field. An item-specific actions template takes precedence over the common template.

The following example displays live order counts as badges on the Orders and Fulfillment items.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/templates/item-actions-template/source.txt)

## Group Header Template

To replace the default content of a [group header](https://www.telerik.com/kendo-angular-ui-develop/components/menus/menu/items#defining-group-headers), apply the [`kendoMenuItemGroupHeaderTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/itemgroupheadertemplatedirective) directive to an `<ng-template>` tag. The template context exposes `item` and `index` of the group header.

Nest the `<ng-template>` tag inside a `<kendo-menu-item>` with [`groupHeader`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/menuitemcomponent#groupheader) set to `true`. For an array of `MenuItem` objects, assign a `TemplateRef` to the header's [`groupHeaderTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/menuitem#groupheadertemplate) field.

The following example adds folder icons to Warehouse reports and Delivery Reports group headers in an operations menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/templates/group-header-template/source.txt)

## Content Template

A content template replaces the child items of a Menu item. Instead of a submenu list, the item opens a popup with your own markup, so it suits richer panels such as a catalog overview.

### Setting the Content Template

To set a content template, [nest an `<ng-template>` tag](https://www.telerik.com/kendo-angular-ui-develop/components/menus/menu/items#using-templates) with the [`kendoMenuItemContentTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/itemcontenttemplatedirective) directive in a `<kendo-menu-item>` component. To set a content template in data-binding scenarios, assign the [`contentTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/menuitem#template) field of the items.

The following example binds the Menu to an array of items and assigns a `TemplateRef` to the `contentTemplate` field of the Products item. The template receives the item through the `item` context variable and renders its child items as a catalog panel. The Solutions item has no content template, so it opens a regular submenu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/templates/content-template/source.txt)

### Using Components with Popups

If a component that is rendered inside the content utilizes a popup that is rendered outside the content, the Menu closes the item as soon as the user hovers over the popup. Even if the popup is rendered inside the content, it may still overflow, which will cause the mouse to leave the Menu when the popup is closed. To avoid this behavior, prevent the [`close`](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api/menucomponent#close) event for items with content or specific item, and provide, for example, a button to close the item.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/templates/content-template-popup/source.txt)

## Suggested Links

* [API Reference of the Menu](https://www.telerik.com/kendo-angular-ui-develop/components/menus/api)
