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({
});

                    

DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.

The following code shows how to create the Menu widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.

jQuery
JavaScript
HTML
$(function () {
    $("#menu").dxMenu({
        items: [
            { text: "Hide" },
            { text: "Delete" },
            {
                text: "Clipboard",
                items: [
                    { text: "Copy" },
                    { text: "Clear" },
                    { text: "Paste" }
                ]
            }
        ]
    });
});
<div id="menu"></div>
Angular
HTML
TypeScript
<dx-menu [items]="menuItems"></dx-menu>
import { DxMenuModule } from 'devextreme-angular';
// ...
export class AppComponent {
    menuItems = [
        { text: "Hide" },
        { text: "Delete" },
        {
            text: "Clipboard",
            items: [
                { text: "Copy" },
                { text: "Clear" },
                { text: "Paste" }
            ]
        }
    ];
}
@NgModule({
    imports: [
        // ...
        DxMenuModule
    ],
    // ...
})
AngularJS
HTML
JavaScript
<div ng-controller="DemoController">
    <div dx-menu="{
        items: menuItems
    }"></div>
</div>
angular.module('DemoApp', ['dx'])
    .controller("DemoController", function ($scope) {
        $scope.menuItems = [
            { text: "Hide" },
            { text: "Delete" },
            {
                text: "Clipboard",
                items: [
                    { text: "Copy" },
                    { text: "Clear" },
                    { text: "Paste" }
                ]
            }
        ];
    });
Knockout
HTML
JavaScript
<div data-bind="dxMenu: {
    items: menuItems
}"></div>
var viewModel = {
    menuItems: [
        { text: "Hide" },
        { text: "Delete" },
        {
            text: "Clipboard",
            items: [
                { text: "Copy" },
                { text: "Clear" },
                { text: "Paste" }
            ]
        }
    ]
};
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");
            clipboardItems.Add().Text("Clear");
            clipboardItems.Add().Text("Paste");
        });
    })
)
@(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")
            clipboardItems.Add().Text("Clear")
            clipboardItems.Add().Text("Paste")
        End Sub)
    End Sub)
)

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 item template.

Type:

Object

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 the 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