Skip to main content

Initialization

info

Download the DHTMLX Tabbar package as part of the DHTMLX Suite library.

Follow these steps to add DHTMLX Tabbar to an application:

<!DOCTYPE html>
<html>
<head>
<title>How to Start with DHTMLX Tabbar</title>
<script type="text/javascript" src="../../codebase/suite.js"></script>
<link rel="stylesheet" href="../../codebase/suite.css">
</head>
<body>
<div id="tabbar_container"></div>
<script>
// creating DHTMLX Tabbar
const tabbar = new dhx.Tabbar("tabbar_container",{
views:[
{ tab: "north" },
{ tab: "south" },
{ tab: "east" },
{ tab: "west" },
]
});
</script>
</body>
</html>

Include source files​

Unpack the downloaded package into your project folder.

Create an HTML file and add the full paths to the JS and CSS files of the DHTMLX Suite library in its header. The files are:

  • suite.js
  • suite.css
<script type="text/javascript" src="../../codebase/suite.js"></script>
<link rel="stylesheet" href="../../codebase/suite.css">

Create a container​

Add a container for Tabbar and give it an id, for example tabbar_container:

<div id="tabbar_container"></div>

Define Tabbar structure​

Specify the structure of the Tabbar. Each tab is an object with attributes, such as the tab name and the CSS class of the tab. For example, to create a Tabbar with four tabs, put their configuration objects into the views array:

const views = [
{ tab: "north" },
{ tab: "south" },
{ tab: "east" },
{ tab: "west" },
];

Initialize Tabbar​

Initialize Tabbar with the dhx.Tabbar object constructor. The constructor takes two parameters:

  • The HTML container for Tabbar
  • An object with configuration properties (optional). If you omit this argument, Tabbar uses the default settings.
const tabbar = new dhx.Tabbar("tabbar_container",{
mode: "bottom",
views: views,
// more config options
});

Configuration properties​

You can find the full list of Tabbar configuration properties in the Tabbar API overview article.

Example​