NavItem

This is a default control for navigation-related components, can contain any other controls as nested items.

Adding NavItem

A navItem can be easily added to a sidebar with the help of the add() method of Tree Collection:

sidebar.data.add({
    type:"navItem", value:"My NavItem"
});

Attributes

  • type - (string) the type of a control, set it to "navItem"
  • id - (string) the id of a control, auto-generated if not set
  • css - (string) adds style classes to a navItem
  • value - (string) a value of the navItem
  • tooltip - (string) a tooltip for the navItem
  • count - (number) a badge with a number
  • countColor - (string) the color of a badge with number: "danger" | "secondary" | "primary" | "success"
  • items - (array) an array of nested controls
  • icon - (string) an icon of the navItem
  • size - (string) defines the size of a navItem: "small"|"medium"|"auto"

Adding an icon

A navItem can have an icon which is set through the corresponding option icon:

{
    type:"navItem", value:"Some",
    icon:"dxi-check"
}

Adding a badge with a number

You can add a number badge to the navItem to display information like the number of new messages. The badge is set via the count property:

{
    type:"navItem", value:"Some",
    icon:"dxi-check",
    count:10
}

Showing/hiding a navItem

To hide/show a navItem, you should pass the ID of the navItem to the hide() / show() Sidebar methods:

sidebar.show(id);
sidebar.hide(id);

Enabling/disabling a navItem

Any navItem in the sidebar can be enabled/disabled:

sidebar.enable(id);
sidebar.disable(id);

Setting tooltip

You can add a tooltip to a navItem:

{
    type:"navItem", 
    value:"Click", 
    tooltip:"Click me and find out why"  }
Back to top