Skip to main content

Customization

Icons​

DHTMLX Toolbar uses the default icons of the DHTMLX library. However, you can use another icon font pack. To do this, include the icon font on the page and assign its icons to Toolbar controls.

For example, to use the Font Awesome icon pack, include a link to its CDN after the source files of DHTMLX Toolbar:

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

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"
integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU"
crossOrigin="anonymous">

Then set an icon name as the value of the icon property in the object with the control parameters:

const toolbarData = [
{ type: "button", icon: "fas fa-bold", twoState: true },
{ type: "button", icon: "fas fa-underline", twoState: true },
{ type: "button", icon: "fas fa-italic", twoState: true },
{ type: "button", icon: "fas fa-strikethrough", twoState: true }
];

Toolbar with Font Awesome bold, underline, italic, and strikethrough two-state buttons in DHTMLX Suite

Related sample: Toolbar. Custom icons

note

You can add the Material Design icon pack in the same way: include a link to its CDN on the page.

Use custom CSS classes​

You can change the look and feel of a toolbar.

Dark-themed Toolbar with custom CSS styling for buttons, search, and login links in DHTMLX Suite

Related sample: Toolbar. Styling (custom CSS)

Follow these steps:

  • Add one or more CSS classes with the settings you need. Place them in the <style> section of your HTML page or in a separate stylesheet. If you use a stylesheet, include it on the page:
<style>
.my-first-class {
/*some styles*/
}

.my-second-class {
/*some styles*/
}
</style>
  • Specify the name of the class you created (or several class names separated by spaces) as the value of the css property in the Toolbar configuration:
 
const toolbar = new dhx.Toolbar("toolbar_container", {
css:"my_first_class my_second_class"
});

For example:

<style>
.custom,.custom--popup-menu {
--dhx-background-primary: #3A434A;
--dhx-background-secondary: #5a6872;
--dhx-background-additional: #5a6872;
--dhx-s-toolbar-background: var(--dhx-background-primary);

--dhx-color-primary: #118d8d;
--dhx-color-primary-hover: #49e9e9;
--dhx-color-primary-active: #49e9e9;

--dhx-font-color-primary: #fff;
--dhx-font-color-secondary: #fff;
--dhx-font-color-additional: #fff;
}
</style>

<script>
const toolbar = new dhx.Toolbar("toolbar", {
css: "custom"
});
toolbar.data.parse(data);
</script>