# MenuBuilder

## Properties

### WriteAction - Func

## Methods

### Animation(System.Boolean)

Disables the menu animation.

#### Parameters

##### enable - `System.Boolean`

Boolean parameter.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Animation(false)
            )
             
```

### Animation(System.Action)

Sets the menu animation options.

#### Parameters

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

The animation settings.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Animation(a => a.Open(o => o.Expand(ExpandDirection.Vertical)))
            )
             
```

### Items(System.Action)

Defines the items in the menu

#### 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 [MenuBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/menubuilder) instance.

#### Example

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

### Direction(System.String)

Specifies Menu opening direction.

#### Parameters

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

The desired direction.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Direction("top")
            )
             
```

### Direction(Kendo.Mvc.UI.MenuDirection)

Specifies Menu opening direction.

#### Parameters

##### value - [MenuDirection](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/menudirection)

The desired direction.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Direction(MenuDirection.Left)
            )
             
```

### DataSource(System.Action)

Configure the DataSource of the component

#### Parameters

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

The action that configures the DataSource of the component.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                .Name("Menu")
                .DataSource(dataSource => dataSource
                    .Read(read => read
                        .Action("Employees", "PanelBar")
                    )
                )
             )
             
```

### DataSource(System.String)

Set ID of the DataSource that to be used for data binding

#### Parameters

##### dataSourceId - `System.String`

#### RETURNS

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

### BindTo(System.Collections.Generic.IEnumerable,System.Action)

Binds the menu to a list of objects. The menu will be "flat" which means a menu item will be created for every item in the data source.

#### Parameters

##### dataSource - `System.Collections.Generic.IEnumerable<T>`

The data source.

##### itemDataBound - System.Action<[MenuItem](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/menuitem),T>

The action executed for every data bound item.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .BindTo(new []{"First", "Second"}, (item, value) =>
                        {
                           item.Text = value;
                        })
            )
             
```

### BindTo(System.Collections.IEnumerable,System.Action)

Binds the menu to a list of objects. The menu will create a hierarchy of items using the specified mappings.

#### Parameters

##### dataSource - `System.Collections.IEnumerable`

The data source.

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

The action which will configure the mappings

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .BindTo(Model, mapping => mapping
                                .For<Customer>(binding => binding
                                    .Children(c => c.Orders) // The "child" items will be bound to the "Orders" property
                                    .ItemDataBound((item, c) => item.Text = c.ContactName) // Map "Customer" properties to MenuItem properties
                                )
                                .For<Order<(binding => binding
                                    .Children(o => null) // "Orders" do not have child objects so return "null"
                                    .ItemDataBound((item, o) => item.Text = o.OrderID.ToString()) // Map "Order" properties to MenuItem properties
                                )
                        )
            )
             
```

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

Binds the menu to a list of items. Use if the menu items are being sent from the controller. To bind the Menu declaratively, use the  method.

#### Parameters

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

The list of items

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("TreeView")
                        .BindTo(model)
            )
             
```

### ItemAction(System.Action)

Callback for each item.

#### Parameters

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

Action, which will be executed for each item.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .ItemAction(item =>
                        {
                            item
                                .Text(...)
                                .HtmlAttributes(...);
                        })
            )
             
```

### HighlightPath(System.Boolean)

Select item depending on the current URL.

#### Parameters

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

If true the item will be highlighted.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .HighlightPath(true)
            )
             
```

### SecurityTrimming(System.Boolean)

Enable/disable security trimming functionality of the component.

#### Parameters

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

If true security trimming is enabled.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .SecurityTrimming(false)
            )
             
```

### SecurityTrimming(System.Action)

Defines the security trimming functionality of the component

#### Parameters

##### securityTrimmingAction - System.Action<[SecurityTrimmingBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/securitytrimmingbuilder)>

The securityTrimming action.

#### RETURNS

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

#### Example

```
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .SecurityTrimming(builder =>
                        {
                            builder.Enabled(true).HideParent(true);
                        })
            )
             
```

### CloseOnClick(System.Boolean)

Specifies that sub menus should close after item selection (provided they won't navigate).

#### Parameters

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

The value for CloseOnClick

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                        .Name("Menu")
                        .CloseOnClick(false)
            )
             
```

### DataTextField(System.String)

Sets the field of the data item that provides the text of the menu items.

#### Parameters

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

The value for DataTextField

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                .Name("Menu")
                .DataTextField("Value")
             )
             
```

### DataUrlField(System.String)

Sets the field of the data item that provides the url of the menu items.

#### Parameters

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

The value for DataUrlField

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                .Name("Menu")
                .DataUrlField("Value")
             )
             
```

### DataSpriteCssClassField(System.String)

Sets the field of the data item that provides the sprite css class of the menu items.

#### Parameters

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

The value for DataSpriteCssClassField

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                .Name("Menu")
                .DataSpriteCssClassField("Value")
             )
             
```

### DataImageUrlField(System.String)

Sets the field of the data item that provides the image url of the menu items.

#### Parameters

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

The value for DataImageUrlField

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                .Name("Menu")
                .DataImageUrlField("Value")
             )
             
```

### DataIconField(System.String)

Sets the field of the data item that provides the icon name of the menu items.The field can also hold an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.

#### Parameters

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

The value for DataIconField

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                .Name("Menu")
                .DataIconField("Value")
             )
             
```

### DataIconClassField(System.String)

Sets the field of the data item that provides the icon class of the menu items.

#### Parameters

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

The value for DataIconClassField

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                .Name("Menu")
                .DataIconClassField("Value")
             )
             
```

### DataActionsField(System.String)

Sets the field of the data item that provides the trailing actions-region content of the menu items, rendered as a k-menu-link-actions span positioned before the item's expand/collapse arrow. This is useful for displaying supplementary information next to a menu item's label, such as a keyboard-shortcut hint (for example, Ctrl+N). If not set, the Menu falls back to using the actions field of the data item. The actions content is rendered as raw, unencoded HTML, so make sure that any value supplied through dataActionsField (or through the item's actions field) is trusted in the same way as content supplied through dataContentField.

#### Parameters

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

The value for DataActionsField

#### RETURNS

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

### DataContentField(System.String)

Sets the field of the data item that provides the content of the menu items.

#### Parameters

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

The value for DataContentField

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                .Name("Menu")
                .DataContentField("Value")
             )
             
```

### DataDescriptionField(System.String)

Sets the field of the data item that provides the secondary description line of the menu items, rendered as a k-menu-link-description span displayed beneath the item's label. This is useful for showing additional context about a menu item, such as a short explanatory note under its title. If not set, the Menu falls back to using the description field of the data item. The description content is HTML-encoded by default, consistent with the item's text, and this can be disabled per item by setting encoded: false on the data item.

#### Parameters

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

The value for DataDescriptionField

#### RETURNS

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

### HoverDelay(System.Double)

Specifies the delay in ms before the menu is opened/closed - used to avoid accidental closure on leaving.

#### Parameters

##### value - `System.Double`

The value for HoverDelay

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                        .Name("Menu")
                        .HoverDelay(300)
            )
             
```

### OpenOnClick(System.Action)

Specifies that the root sub menus will be opened on item click.

#### Parameters

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

The configurator for the openonclick setting.

#### RETURNS

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

### OpenOnClick()

Specifies that the root sub menus will be opened on item click.

#### RETURNS

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

### OpenOnClick(System.Boolean)

Specifies that the root sub menus will be opened on item click.

#### Parameters

##### enabled - `System.Boolean`

Enables or disables the openonclick option.

#### RETURNS

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

### Scrollable(System.Action)

If enabled, the Menu displays buttons that scroll the items when they cannot fit the width or the popups' height of the Menu. By default, scrolling is disabled.The following example demonstrates how to enable the scrolling functionality.

#### Parameters

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

The configurator for the scrollable setting.

#### RETURNS

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

### Scrollable()

If enabled, the Menu displays buttons that scroll the items when they cannot fit the width or the popups' height of the Menu. By default, scrolling is disabled.The following example demonstrates how to enable the scrolling functionality.

#### RETURNS

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

### Scrollable(System.Boolean)

If enabled, the Menu displays buttons that scroll the items when they cannot fit the width or the popups' height of the Menu. By default, scrolling is disabled.The following example demonstrates how to enable the scrolling functionality.

#### Parameters

##### enabled - `System.Boolean`

Enables or disables the scrollable option.

#### RETURNS

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

### Orientation(Kendo.Mvc.UI.MenuOrientation)

Specifies the orientation in which the menu items will be ordered.

#### Parameters

##### value - [MenuOrientation](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/menuorientation)

The value for Orientation

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Orientation(MenuOrientation.Vertical)
            )
             
```

### IconPosition(Kendo.Mvc.UI.IconPosition)

Specifies the position of the icon in the Menu items using the text content as a reference.

#### Parameters

##### value - [IconPosition](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/iconposition)

The value for IconPosition

#### RETURNS

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

#### Example

```
 
            @( Html.Kendo().Menu()
                        .Name("Menu")
                        .IconPosition(IconPosition.After)
            )
             
```

### Size(Kendo.Mvc.UI.ComponentSize)

Sets the size of the component.

#### Parameters

##### value - [ComponentSize](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/componentsize)

The value for Size

#### RETURNS

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

### Events(System.Action)

Configures the client-side events.

#### Parameters

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

The client events action.

#### RETURNS

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

#### Example

```
 
            @(Html.Kendo().Menu()
                  .Name("Menu")
                  .Events(events => events
                      .Close("onClose")
                  )
            )
             
```

### ToComponent()

Returns the internal view component.

#### RETURNS

The  instance that represents the component.

### Expression(System.String)

Sets the name of the component.

#### Parameters

##### modelExpression - `System.String`

The name.

#### RETURNS

Returns the current  instance.

### Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

#### Parameters

##### modelExplorer - `Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer`

The name.

#### RETURNS

Returns the current  instance.

### Name(System.String)

Sets the name of the component.

#### Parameters

##### componentName - `System.String`

The name.

#### RETURNS

Returns the current  instance.

### Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean,System.Boolean)

#### Parameters

##### deferred - `System.Boolean`

#### RETURNS

Returns a [DeferredWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/deferredwidgetbuilder) instance.

### HtmlAttributes(System.Object)

Sets the HTML attributes.

#### Parameters

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

The HTML attributes.

#### RETURNS

Returns the current  instance.

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

Sets the HTML attributes.

#### Parameters

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

The HTML attributes.

#### RETURNS

Returns the current  instance.

### ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

#### Parameters

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

The JavaScript attributes.

##### overrideAttributes - `System.Boolean`

Argument which determines whether attributes should be overriden.

#### RETURNS

Returns the current  instance.

### ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

#### Parameters

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

The JavaScript attributes.

##### overrideAttributes - `System.Boolean`

Argument which determines whether attributes should be overriden.

#### RETURNS

Returns the current  instance.

### Render()

Renders the component in place.

### ToHtmlString()

Returns the HTML representation of the component.

### WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

#### Parameters

##### writer - `System.IO.TextWriter`

##### encoder - `System.Text.Encodings.Web.HtmlEncoder`

### ToClientTemplate()

Returns the client template for the component.

### AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

#### Parameters

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

#### RETURNS

Returns the current  instance.
