# MenuItemBuilder

## Properties

### ViewContext - ViewContext

## Methods

### Items(System.Action)

Configures the child items of a [MenuItem](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/menuitem).

#### Parameters

##### addAction - System.Action<[MenuItemFactory](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitemfactory)>

The add action.

#### RETURNS

Returns the current [MenuItemBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitembuilder) instance.

#### Example

```
 
             @( Html.Kendo().tMenu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Text("First Item").Items(firstItemChildren =>
                            {
                                firstItemChildren.Add().Text("Child Item 1");
                                firstItemChildren.Add().Text("Child Item 2");
                            });
                        })
            )
             
```

### Items(System.Collections.Generic.IEnumerable)

Configures the child items of a [MenuItem](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/menuitem). When declaratively binding the menu item, use Kendo.Mvc.UI.Fluent.MenuItemBuilder.Items(System.Action{Kendo.Mvc.UI.Fluent.MenuItemFactory}).

#### Parameters

##### items - System.Collections.Generic.IEnumerable<[MenuItem](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/menuitem)>

items

#### RETURNS

Returns the current [MenuItemBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitembuilder) instance.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Text("First Item").Items(model);
                        })
            )
             
```

### Icon(System.String)

Renders an icon for the item.

#### Parameters

##### icon - `System.String`

#### RETURNS

Returns the current [MenuItemBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitembuilder) instance.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Icon("gear");
                        })
            )
             
```

### Icon(System.Action)

Renders an icon for the item as an icon descriptor.

#### Parameters

##### configurator - System.Action<[MenuItemIconSettingsBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitemiconsettingsbuilder)>

#### RETURNS

Returns the current [MenuItemBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitembuilder) instance.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Icon(icon => icon.Name("gear").Variant("duotone"));
                        })
            )
             
```

### IconClass(System.String)

Renders an icon class for the item.

#### Parameters

##### iconClass - `System.String`

#### RETURNS

Returns the current [MenuItemBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitembuilder) instance.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().IconClass("custom-icon-class");
                        })
            )
             
```

### Separator(System.Boolean)

Renders a separator item

#### Parameters

##### value - `System.Boolean`

#### RETURNS

Returns the current [MenuItemBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitembuilder) instance.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Separator(true);
                        })
            )
             
```

### GroupHeader(System.Boolean)

Indicates whether the menu item is rendered as a decorative, non-interactive group header instead of a regular selectable menu item.

#### Parameters

##### value - `System.Boolean`

#### RETURNS

Returns the current [MenuItemBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menuitembuilder) instance.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Text("Group 1").GroupHeader(true);
                        })
            )
             
```

### Description(System.String)

Specifies the description of the menu item. The description is HTML encoded unless Encoded(false) is set.

#### Parameters

##### value - `System.String`

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Text("New").Description("Create a new document");
                        })
            )
             
```

### Actions(System.String)

Specifies the actions content of the menu item, such as keyboard shortcuts. The content is HTML encoded unless Encoded(false) is set.

#### Parameters

##### value - `System.String`

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {
                            items.Add().Text("New").Actions("Ctrl+N");
                        })
            )
             
```

### ToItem()

Returns the inner navigation item

### HtmlAttributes(System.Object)

Sets the HTML attributes applied to the outer HTML element rendered for the item

#### Parameters

##### attributes - `System.Object`

The attributes.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Attributes(new {@class="first-item"}))
            )
             
```

### HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes applied to the outer HTML element rendered for the item

#### Parameters

##### attributes - `System.Collections.Generic.IDictionary<String,Object>`

The attributes.

### LinkHtmlAttributes(System.Object)

LinkHtmlAttributes method.

#### Parameters

##### attributes - `System.Object`

### LinkHtmlAttributes(System.Collections.Generic.IDictionary)

LinkHtmlAttributes method.

#### Parameters

##### attributes - `System.Collections.Generic.IDictionary<String,Object>`

### Text(System.String)

Sets the text displayed by the item.

#### Parameters

##### value - `System.String`

The value.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item"))
            )
             
```

### Visible(System.Boolean)

Sets the text displayed by the item.

#### Parameters

##### value - `System.Boolean`

The value.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item").Visible((bool)ViewData["visible"]))
            )
             
```

### Enabled(System.Boolean)

Enables or disables the item. Disabled item cannot be clicked, expanded or open (depending on the item type - menu, tabstrip, panelbar).

#### Parameters

##### value - `System.Boolean`

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item").Enabled((bool)ViewData["enabled"]))
            )
             
```

### Selected(System.Boolean)

Selects or unselects the item. By default items are not selected.

#### Parameters

##### value - `System.Boolean`

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item").Selected(true))
            )
             
```

### Route(System.String,Microsoft.AspNetCore.Routing.RouteValueDictionary)

Sets the route to which the item should navigate.

#### Parameters

##### routeName - `System.String`

Name of the route.

##### routeValues - `Microsoft.AspNetCore.Routing.RouteValueDictionary`

The route values.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item").Route("Default", new RouteValueDictionary { {"id", 1} }))
            )
             
```

### Route(System.String,System.Object)

Sets the route to which the item should navigate.

#### Parameters

##### routeName - `System.String`

Name of the route.

##### routeValues - `System.Object`

The route values.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item").Route("Default", new {id, 1}))
            )
             
```

### Route(System.String)

Sets the route to which the item should navigate.

#### Parameters

##### routeName - `System.String`

Name of the route.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item").Route("Default"))
            )
             
```

### Action(Microsoft.AspNetCore.Routing.RouteValueDictionary)

Sets the action to which the item should navigate

#### Parameters

##### routeValues - `Microsoft.AspNetCore.Routing.RouteValueDictionary`

The route values of the Action method.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("Index").Action(MVC.Home.Index(3).GetRouteValueDictionary()))
            )
             
```

### Action(System.String,System.String,Microsoft.AspNetCore.Routing.RouteValueDictionary)

Sets the action to which the item should navigate

#### Parameters

##### actionName - `System.String`

Name of the action.

##### controllerName - `System.String`

Name of the controller.

##### routeValues - `Microsoft.AspNetCore.Routing.RouteValueDictionary`

The route values.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("Index").Action("Index", "Home", new RouteValueDictionary{ {"id", 1} }))
            )
             
```

### Action(System.String,System.String,System.Object)

Sets the action to which the item should navigate

#### Parameters

##### actionName - `System.String`

Name of the action.

##### controllerName - `System.String`

Name of the controller.

##### routeValues - `System.Object`

The route values.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("Index").Action("Index", "Home", new {id, 1}))
            )
             
```

### Action(System.String,System.String)

Sets the action to which the item should navigate

#### Parameters

##### actionName - `System.String`

Name of the action.

##### controllerName - `System.String`

Name of the controller.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("Index").Action("Index", "Home"))
            )
             
```

### Url(System.String)

Sets the URL to which the item should navigate

#### Parameters

##### value - `System.String`

The value.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("www.example.com").Url("http://www.example.com"))
            )
             
```

### ImageUrl(System.String)

Sets the URL of the image that should be displayed by the item.

#### Parameters

##### value - `System.String`

The value.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("First Item").ImageUrl("~/Content/first.png"))
            )
             
```

### ImageHtmlAttributes(System.Object)

Sets the HTML attributes for the item image.

#### Parameters

##### attributes - `System.Object`

The attributes.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items
                               .Add().Text("First Item")
                               .ImageUrl("~/Content/first.png")
                               .ImageHtmlAttributes(new {@class="first-item-image"}))
            )
             
```

### ImageHtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes for the item image.

#### Parameters

##### attributes - `System.Collections.Generic.IDictionary<String,Object>`

The attributes.

### SpriteCssClasses(System.String\[])

Sets the sprite CSS class names.

#### Parameters

##### cssClasses - `System.String[]`

The CSS classes.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items
                               .Add().Text("First Item")
                               .SpriteCssClasses("icon", "first-item"))
            )
             
```

### Content(System.Action)

Sets the HTML content which the item should display.

#### Parameters

##### value - `System.Action`

The action which renders the content.

#### Example

```
 
             @( Html.Kendo().Menu()
                       .Name("Menu")
                       .Items(items => items
                                .Add()
                                .Text("First Item")
                                .Content(() =>
                                {
                                    <strong> First Item Content</strong>
                                }))
                       .Render();
            )
             
```

### Content(System.Func)

Sets the HTML content which the item should display.

#### Parameters

##### value - `System.Func<Object,Object>`

The content wrapped in a regular HTML tag or text tag (Razor syntax).

#### Example

```
 
             @(Html.Kendo().Menu()
                  .Name("Menu")
                  .Items(items => items
                           .Add()
                           .Text("First Item")
                           .Content(
                                @<text>
                                        Some text
                                        <strong> First Item Content</strong>
                                </text>
                           );
                  )
             )
             
```

### Content(System.String)

Sets the HTML content which the item should display as a string.

#### Parameters

##### value - `System.String`

The action which renders the content.

#### Example

```
 
             @( Html.Kendo().Menu()
                       .Name("Menu")
                       .Items(items => items
                                .Add()
                                .Text("First Item")
                                .Content("<strong> First Item Content</strong>");
                             )
                       .Render();
            )
             
```

### ContentHtmlAttributes(System.Object)

Sets the HTML attributes of the content element of the item.

#### Parameters

##### attributes - `System.Object`

The attributes.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items
                               .Add().Text("First Item")
                               .Content(() => { ) <strong>First Item Content</strong> @( })
                               .ContentHtmlAttributes(new {@class="first-item-content"})
                        )
            )
             
```

### ContentHtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes of the content element of the item.

#### Parameters

##### attributes - `System.Collections.Generic.IDictionary<String,Object>`

The attributes.

### Action(System.Linq.Expressions.Expression)

Makes the item navigate to the specified controllerAction method.

#### Parameters

##### controllerAction - `System.Linq.Expressions.Expression<Action>`

The action.

#### Example

```
 
              @( Html.Kendo().Menu()
                         .Name("Menu")
                         .Items(items => items
                                .Add().Text("First Item")
                                .Action<HomeController>(controller => controller.Index()))
            
             )
              
```

### Encoded(System.Boolean)

Sets whether the Text property should be encoded when the item is rendered.

#### Parameters

##### isEncoded - `System.Boolean`

Whether the property should be encoded. Default: true.

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items => items.Add().Text("<strong>First Item</strong>").Encoded(false))
            )
             
```
