DevExtreme React - Control the Behavior

An end user can select Tabs items in two different modes: 'single' (by default) or 'multiple'. You can use the selectionMode option to change the mode.

JavaScript
$(function() {
    $("#tabsContainer").dxTabs({
        items: tabItems,
        selectionMode: "multiple"
    });
});

If you need a tab to be preselected or to select it programmatically, pass its index in the data source array to the selectedIndex option.

JavaScript
var tabs = [
    { text: "User", icon: "user" },
    { text: "Find", icon: "find" },
    { text: "Favorites", icon: "favorites" }
];

$(function() {
    $("#tabsContainer").dxTabs({
        items: tabs,
        // Preselects the tab with index 1
        selectedIndex: 1
    });
});
JavaScript
// Selects the tab with index 0
$("#tabsContainer").dxTabs("option", "selectedIndex", 0);

As an alternative, you can use the selectedItem (for "single" selectionMode) or selectedItems (for "multiple" selectionMode) options.

JavaScript
var tabs = [
    { text: "User", icon: "user" },
    { text: "Find", icon: "find" },
    { text: "Favorites", icon: "favorites" }
];

$(function() {
    $("#tabsContainer").dxTabs({
        items: tabs,
        selectedItem: tabs[1],
        // === or ===
        selectionMode: 'multiple',
        selectedItems: [ tabs[1], tabs[2] ]
    });
});

When the total length of all tabs exceeds the Tabs container, the widget shows navigation buttons that help an end user scroll the tab strip. This behavior is default only for desktops. To enable it on all types of devices, assign true to the showNavButtons option. Otherwise, assign false.

JavaScript
$(function() {
    $("#tabsContainer").dxTabs({
        items: tabs,
        showNavButtons: true
    });
});
See Also