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.
$(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.
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 }); });
// 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.
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.
$(function() { $("#tabsContainer").dxTabs({ items: tabs, showNavButtons: true }); });
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.