Menu

The Menu widget is a panel with clickable items. A click on an item opens a drop-down menu, which can contain several submenus.

Included in: dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/menu
Export: default
Menu interactive configuration
Copy Code
Copy to Codepen
$("#menu").dxMenu({
});

You can create the widget using one of the following approaches.

jQuery
JavaScript
HTML
var menuItems = [
    { text: "Hide" },
    { text: "Delete" },
    {
        text: "Clipboard",
        items: [
            { text: "Copy text" },
            { text: "Clear text" },
            { text: "Paste text" }
        ]
    }
];
$(function () {
    $("#menu").dxMenu({
        items: menuItems
    });
});
<div id="menu"></div>
Angular
HTML
TypeScript
<dx-menu [items]="menuItems"></dx-menu>
export class AppComponent {
    menuItems = [
        // ...   
    ];
}
AngularJS
HTML
JavaScript
<div ng-controller="DemoController">
    <div dx-menu="{
        items: menuItems
    }"></div>
</div>
angular.module('DemoApp', ['dx'])
    .controller("DemoController", function ($scope) {
        $scope.menuItems = [
            // ...   
        ];
    });
Knockout
HTML
JavaScript
<div data-bind="dxMenu: {
    items: menuItems
}"></div>
var viewModel = {
    menuItems: [
        // ...
    ]
};
ko.applyBindings(viewModel);
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().Menu()
    .ID("menu")
    .Items(items => {
        items.Add().Text("Hide");
        items.Add().Text("Delete");
        items.Add().Text("Clipboard").Items(clipboardItems => {
            clipboardItems.Add().Text("Copy text");
            clipboardItems.Add().Text("Clear text");
            clipboardItems.Add().Text("Paste text");
        });
    })
)
@(Html.DevExtreme().Menu() _
    .ID("menu") _
    .Items(Sub(items)
        items.Add().Text("Hide")
        items.Add().Text("Delete")
        items.Add().Text("Clipboard").Items(Sub(clipboardItems)
            clipboardItems.Add().Text("Copy text")
            clipboardItems.Add().Text("Clear text")
            clipboardItems.Add().Text("Paste text")
        End Sub)
    End Sub)
)

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the topics in the Installation section.

View Demo Watch Video

See Also
Show Example:
AngularJS
Knockout
jQuery

Configuration

An object defining configuration options for the Menu widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this widget.

See Also

Default Item Template

This section lists the data source fields that are used in a default template for menu items.

By default, a predefined item template is applied to display the items of this widget. This template is based on certain fields of the data source provided for this widget. Below is a list of these fields. If the default item template is not appropriate for your task, implement a custom item template based on these or other fields of your data source.

See Also