Configuration
Close buttons for tabs

Related sample: Tabbar. Close button
The closable property adds close buttons to tabs. Users can click a close button to close the tab. Set the property to true to add close buttons to all tabs:
const tabbar = new dhx.Tabbar("tabbar_container", {
closable: true
});
To add close buttons only to specific tabs, set the closable property to an array of tab ids:
const tabbar = new dhx.Tabbar("tabbar_container", {
closable: ["paris", "london"]
});
Disabled tabs

If you don't set the disabled property, all tabs are enabled. Set the property to disable one or several tabs:
// make one tab disabled
const tabbar = new dhx.Tabbar("tabbar_container", {
disabled: "London"
});
// make several tabs disabled
const tabbar = new dhx.Tabbar("tabbar_container", {
disabled: ["Paris", "Rome"]
});
Related sample: Tabbar. Rich configuration (close, disable, overflow, active tab)
Position of tabbar

Related sample: Tabbar. Mode: top, left, right, bottom
The mode property sets the side of Tabbar where tabs appear. The default value is "top". You can also set the property to "bottom", "left", or "right":
const tabbar = new dhx.Tabbar("tabbar_container", {
mode: "left"
});
Size of tabs
The tabWidth and tabHeight properties set the width and height of tabs. The default width is 200px, and the default height is 45px. Set the properties to change the default tab size:
const tabbar = new dhx.Tabbar("tabbar_container", {
tabWidth: 190,
tabHeight: 50
});
Related sample: Tabbar. Tab size
Structure of tabs
Define the structure of Tabbar in the views property when you initialize the component. Each tab is an object that can include the following properties:
id— the id of a tabtab— the name of a tabtabCss— the name of the CSS class used for a tabcss— the name of the CSS class used for a cellheader— the header of a cellhtml— HTML content of a cellpadding— the distance between the content of a cell and the border of tabbartabWidth— the width of a tab (for more information, seeviews)tabHeight— the height of a tab (for more information, seeviews)
const tabbar = new dhx.Tabbar("tabbar_container", {
views: [
{ tab: "left", css: "panel flex", header: "Left" },
{ tab: "west", css: "panel flex", header: "West" },
{ tab: "east", css: "panel flex", header: "East" },
{ tab: "right", css: "panel flex", header: "Right" }
]
});
Related sample: Tabbar. Tab size
HTML content in tab titles

Use the tabTemplate option to render HTML content in tab titles, for example, an icon next to the tab name. The option is a callback function that defines the template for the titles of all tabs.
Tabbar calls the function for each tab with the following parameters:
cell— (object) the configuration object of the current tab (id,tab,html, and other tab properties)activeTab— (string) the id of the active tab
The function returns an HTML string, and Tabbar inserts it into the DOM of the tab:
<script>
const tabbar = new dhx.Tabbar("tabbar_container", {
mode: "top",
css: "dhx_widget--bordered",
tabTemplate: (cell, activeTab) => {
const isActive = cell.id === activeTab;
return `
<i class="icon icon-${cell.icon}"></i>
<span class="${isActive ? "tab-title tab-title--active" : "tab-title"}">${cell.tab}</span>
`;
},
views: [
{ id: "vilnius", tab: "Vilnius", icon: "cloud", html: "..." },
{ id: "paris", tab: "Paris", icon: "sun", html: "..." },
{ id: "london", tab: "London", icon: "rain", html: "..." },
{ id: "rome", tab: "Rome", icon: "sun", html: "..." }
]
});
</script>
Without the tabTemplate option, Tabbar renders each tab as plain text. The tab property of a tab is always a string, and Tabbar never interprets it as HTML, whether you use tabTemplate or not. If you set tabTemplate, your function controls the rendering of all tabs and builds their entire markup.
Related sample: Tabbar. Tab with HTML template
Autosize for tabs
If you don't set the width or height of tabs, you can make the tabs adjust automatically to the size of the Tabbar container. Set the tabAutoWidth or tabAutoHeight property to true:
const tabbar = new dhx.Tabbar("tabbar_container", {
views: [
{ tab: "left", css: "panel flex", header: "Left" },
{ tab: "west", css: "panel flex", header: "West" },
{ tab: "east", css: "panel flex", header: "East" },
{ tab: "right", css: "panel flex", header: "Right" }
],
tabAutoWidth: true,
mode: "top"
});
Related sample: Tabbar. Tab auto width
Related sample: Tabbar. Tab auto height
The tabAutoWidth option takes effect when mode is "top" or "bottom". The tabAutoHeight option takes effect when mode is "left" or "right".
Tabs without content
Set the noContent option to true to render tabs without content:
const tabbar = new dhx.Tabbar("tabbar_container", {
noContent: true
});
Related sample: Tabbar. Without content
Alignment

From v7.0, you can align tabs with the tabAlign option:
const tabbar = new dhx.Tabbar("tabbar_container", {
views: [
{ tab: "left", css: "panel flex", header: "Left" },
{ tab: "west", css: "panel flex", header: "West" },
{ tab: "east", css: "panel flex", header: "East" },
{ tab: "right", css: "panel flex", header: "Right" }
],
tabAlign: "center"
});
Related sample: Tabbar. Tab align
The option takes the following values: "left" or "start", "center" or "middle", and "right" or "end".