UI Widgets NavBar

A widget that contains items used to navigate through application views.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js

The dxNavBar widget displays navigation items that perform an action when clicked.

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

  • jQuery
    Use the dxNavBar jQuery plug-in.

    HTML
    <div id="navBar"></div>
    JavaScript
    var navItems = [
        { text: "Home", icon: "home" },
        { text: "About", icon: "info" },
        { text: "favorites", icon: "favorites", badge: "new" }
    ];
    $("#navBar").dxNavBar({
        dataSource: navItems
    });
  • Knockout
    Add a div element and apply the dxNavBar binding to this element.

    HTML
    <div data-bind="dxNavBar: {
        dataSource: navItems
    }"></div>
  • Angular
    Add a div element and apply the dx-nav-bar directive to this element.

    HTML
    <div dx-nav-bar="{
        dataSource: navItems
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required.

See Also

Since the dxNavBar widget is used to display multiple items, it supports the common Collection Container widget functionality. You can find detailed information on principles of working with the widget in the dxNavBar section of the Collection Container Widgets article.

View Demo

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController">
    <div dx-nav-bar="{ dataSource: navItems, onItemClick: navItemClicked }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.navItems = [
        { text: "user", icon: "user" },
        { text: "find", icon: "find" },
        { text: "favorites", icon: "favorites", badge: "New" },
        { text: "about", icon: "info" },
        { text: "home", icon: "home" },
        { text: "URI", icon: "tips", badge: "!" }
    ];
    $scope.navItemClicked = function (e) {
        DevExpress.ui.notify(e.itemData.text + " navigation item is clicked", "success", 2000);
    };
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
<div data-bind="dxNavBar:{ dataSource: navItems, onItemClick: navItemClicked }"></div>
var myViewModel = {
    navItems: [
        { text: "user", icon: "user" },
        { text: "find", icon: "find" },
        { text: "favorites", icon: "favorites", badge: "New" },
        { text: "about", icon: "info" },
        { text: "home", icon: "home" },
        { text: "URI", icon: "tips", badge: "!" }
    ],
    navItemClicked: function (e) {
        DevExpress.ui.notify(e.itemData.text + " navigation item is clicked", "success", 2000);
    }
}
ko.applyBindings(myViewModel);
<div id="myNavBar"></div>
$("#myNavBar").dxNavBar({
    dataSource: [
        { text: "user", icon: "user" },
        { text: "find", icon: "find" },
        { text: "favorites", icon: "favorites", badge: "New" },
        { text: "about", icon: "info" },
        { text: "home", icon: "home" },
        { text: "URI", icon: "tips", badge: "!" }
    ],
    onItemClick: function (e) {
        DevExpress.ui.notify(e.itemData.text + " navigation item is clicked", "success", 2000);
    }
});

Configuration

An object defining configuration options for the dxNavBar widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events exposed by this widget.

Default Item Template

This section lists the data source fields that are used in a default template for navbar 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 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