Configuration
Checkboxes for items

DHTMLX Tree supports two-state and three-state checkboxes. A two-state checkbox lets users check and uncheck a tree item. A three-state checkbox also has an intermediate state that appears when only some children of a parent item are checked.
Set the checkbox configuration option to true to enable checkboxes for items:
const tree = new dhx.Tree("tree_container", { checkbox: true });
Related sample: Tree. Inline editing, drag-and-drop and checkboxes
Collapsed mode
To initialize a tree in the collapsed state, use the collapsed property:
const tree = new dhx.Tree("tree_container", {
collapsed: true,
});
Related sample: Tree. Collapsed mode
Editing of items

Set the editable configuration property to true to let users edit the text of Tree items:
const tree = new dhx.Tree("tree_container", { editable: true });
Related sample: Tree. Inline editing, drag-and-drop and checkboxes
Key navigation
Set the keyNavigation property to true to enable key navigation in a tree:
const tree = new dhx.Tree("tree_container", { keyNavigation: true });
After you select an item, use the arrow keys to navigate the tree:
| Up arrow key | moves the selection to the item above |
| Down arrow key | moves the selection to the item below |
| Right arrow key | opens the selected folder |
| Left arrow key | closes the selected open folder |
Related sample: Tree. Key navigation
Selection of items

Related sample: Tree. Disable selection
The default Tree configuration lets users select and highlight an item. To disable selection, set the selection configuration property to false:
const tree = new dhx.Tree("tree_container", {
selection: false,
});
Tooltips for items
Use the tooltip configuration option to add tooltips to Tree items. You can enable the default tooltips, pass a template function that renders custom content in the tooltips, or pass an object with extended tooltip options. Check the following examples:
- A configuration object with a custom template and a display delay:
const tree = new dhx.Tree("tree_container", {
tooltip: {
htmlEnable: true,
// the 500ms delay before showing
showDelay: 500,
// the tooltip will appear to the right of the item
position: "right",
// a CSS class for styling
css: "custom-tooltip-style",
// the template function
template: (item, event) => {
// display the item's name and the number of children (if any)
const count = item.items ? ` (${item.items.length})` : "";
return `<span className="tooltip-title">${item.value}</span><span className="tooltip-count">${count}</span>`;
}
}
});
- A function that defines the tooltip content:
const tree = new dhx.Tree("tree_container", {
tooltip: (item) =>
(item.value + (item.items ? ` (${item.items?.length})` : "") + "")
});
Related sample: Tree. Tooltip template
The tooltip property can have the following types of values:
boolean— iftrue, enables the standard tooltip that shows thevalueproperty of the itemfunction— a template function that returns the string content of the tooltipobject— a configuration object for detailed customization of tooltip behavior and appearance. The object can contain the following properties:template- (optional) a function that determines the content of the tooltip. It takes two arguments:item- (object) the data object of a tree item.event- (object) the native mouse event (MouseEvent). The template function must return a string.
force- (optional) iftrue, forces the tooltip to appear without delays. In this case, the tooltip ignores theshowDelayandhideDelaysettings. The default value isfalse.showDelay- (optional) the delay before the tooltip appears (in milliseconds).hideDelay- (optional) the delay before the tooltip hides (in milliseconds).htmlEnable- (optional) specifies whether the tooltip can contain HTML markup.margin- (optional) the margin between the tree item and the tooltip (in pixels). The default value is8.position- (optional) the position of the tooltip relative to the item. The possible values are:"right","bottom","center","left","top". The default value is"bottom".css- (optional) the name of the CSS class for customizing the style of the tooltip container.