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

Type: Object

This widget displays navigation items that perform an action when clicked. To create the dxNavBar widget, add a div element with dxNavBar Knockout binding within the body of the required view.

<div id="navBarContainer" data-bind="dxNavBar:{dataSource: navItems, itemClickAction: navItemClicked}"></div>

The navbar items are loaded from an array specified by the dataSource configuration option. You can specify an array of objects as the widget data source.

var navItems = [
        { text: "user", icon: "user" },
        { text: "find", icon: "find" },
        { text: "favorites", icon: "favorites" },
        { text: "about", icon: "info" },
        { text: "home", icon: "home" },
        { text: "URI", icon: "tips" }

You can use the icons from the built-in icon library. For this purpose, specify the icon field in the widget data source (see the example above). Alternatively, you can set external icons using the iconSrc field of the widget data source, as shown in the following example.

var navItems = [
        { text: "user", iconSrc: "images/icons/user.png" },
        { text: "find", iconSrc: "images/icons/find.png" },

To display widget items, a default template is applied based on the following fields of the data source item objects.

  • disabled
    Specifies whether or not the widget item is disabled.
  • visible
    Specifies whether or not the widget item is visible.
  • html
    Specifies the html code inserted into the item element.
  • text
    Specifies the text inserted into the item element.
  • icon
    Specifies the name of the icon displayed by the widget item.
  • iconsrc
    Specifies a URL pointing to the image to be displayed by the widget item.

You can introduce a custom template for widget items. For this purpose, add a div element with the data-options attribute set to dxTemplate. Assign item to the template name. In this instance, the template will be applied automatically. See the Customize Widget Item Appearance topic to learn more about templates.

Declare a function that processes a navbar item click and assign it to the itemClickAction configuration option.

var navItemClicked = function(e){
    alert(e.itemData.text + "navigation item clicked");

Note that you can access the clicked item fields via the itemData field of the object passed as an argument to the itemClickAction function.

Refer to the Add a widget documentation section to learn how to create widgets in detail.

Show Example:


An object defining configuration options for the dxNavBar widget.


This section describes methods that can be used to manipulate a widget.


This section describes events fired by this component.