npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dhtmlx/tree

v9.3.4

Published

DHTMLX Tree – JavaScript tree view component with drag-and-drop, inline editing, checkboxes, filtering, and custom templates

Readme

DHTMLX Tree — JavaScript Tree View Component (GPL Edition)

dhtmlx.com npm: v.9.3.4 License: GPL v2

@dhtmlx/tree is a JavaScript tree view component for building hierarchical navigation interfaces with drag-and-drop reordering, inline editing, checkboxes, filtering, sorting, custom item templates, and keyboard navigation.

It is a framework-agnostic component that works with plain JavaScript and integrates with React, Angular, Vue, and Svelte.

It is ideal for prototyping file browsers, navigation menus, category trees, and other hierarchical UI structures in open-source projects or evaluating DHTMLX Tree's core features under the GPL v2 license.

DHTMLX Tree screenshot


License

This edition of DHTMLX Tree is licensed under the GNU General Public License v2.0 (GPL v2).

You can redistribute this package and/or modify it under the terms of the GPL v2.

GPL v2 requires that any project using this package also be open source under a GPL-compatible license.

You may NOT use this package in closed-source, proprietary, or commercial applications without a separate commercial license. For commercial use, please obtain a commercial license of DHTMLX Tree (PRO edition).

This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL v2 for more details.

Using DHTMLX Tree in a commercial or closed-source project?

You need a commercial license. DHTMLX offers Individual, Commercial, Enterprise, and Ultimate license tiers.

Copyright © 2026 XB Software Ltd.


What is DHTMLX Tree

DHTMLX Tree is a JavaScript tree view component for rendering hierarchical data structures in web applications. It supports unlimited nesting depth, dynamic data rendering for large datasets, drag-and-drop reordering within and between trees, inline item editing, two-state and three-state checkboxes, item filtering and sorting, and custom HTML templates per node. The component exposes a TreeCollection API for adding, updating, removing, filtering, and sorting items programmatically at runtime.

This is the GPL (open source) edition of DHTMLX Tree, distributed as the @dhtmlx/tree npm package. It is part of the DHTMLX Suite family of UI components and can be used standalone or alongside other Suite widgets such as DHTMLX Grid, Layout, or Toolbar.

Use this GPL edition when you want to prototype hierarchical navigation, integrate a tree view into an open-source project, or evaluate DHTMLX Tree's core features before obtaining a commercial license.


Quick Start

Install the package, import the styles, and initialize the tree in a container element.

Install

npm install @dhtmlx/tree

Include in your project

import { Tree } from "@dhtmlx/tree";
import "@dhtmlx/tree/tree.css";

Or via CDN as part of DHTMLX Suite:

<link rel="stylesheet" href="https://cdn.dhtmlx.com/suite/edge/suite.css" />
<script type="text/javascript" src="https://cdn.dhtmlx.com/suite/edge/suite.js"></script>

Or with script tags pointing to local files:

<script src="path/to/tree.js"></script>
<link rel="stylesheet" href="path/to/tree.css">

The CSS import is required for default tree styling and layout.

Initialize

import { Tree } from "@dhtmlx/tree";
import "@dhtmlx/tree/tree.css";

const tree = new Tree("tree_container", {
    checkbox: true,
    keyNavigation: true
});

tree.data.parse([
    {
        value: "Books",
        id: "books",
        items: [
            { value: "Fiction",     id: "fiction" },
            { value: "Non-fiction", id: "nonfiction" }
        ]
    },
    {
        value: "Magazines",
        id: "magazines",
        items: [
            { value: "Science",  id: "science" },
            { value: "Business", id: "business" }
        ]
    }
]);

Add a container element to your HTML:

<div id="tree_container" style="height: 400px; width: 300px;"></div>

See a live demo


Basic Usage — DHTMLX Tree

Initialize DHTMLX Tree with drag-and-drop, inline editing, and a custom tooltip template:

import { Tree } from "@dhtmlx/tree";
import "@dhtmlx/tree/tree.css";

const tree = new Tree("tree_container", {
    editable: true,         // enable inline editing on double-click
    checkbox: true,         // show checkboxes on all items
    keyNavigation: true,    // enable arrow-key navigation
    tooltip: item => {
        const childCount = item.items ? ` (${item.items.length} children)` : "";
        return item.value + childCount;
    }
});

tree.data.parse([
    {
        value: "Documents",
        id: "docs",
        items: [
            { value: "Reports",   id: "reports" },
            { value: "Contracts", id: "contracts" }
        ]
    },
    {
        value: "Images",
        id: "images",
        items: [
            { value: "Photos",      id: "photos" },
            { value: "Screenshots", id: "screenshots" }
        ]
    }
]);

// Get all checked item IDs after user interaction
tree.events.on("itemClick", () => {
    const checked = tree.getChecked();
    console.log("Checked items:", checked);
});

The editable: true option enables double-click inline editing of item labels. The dragMode: "both" option allows users to reorder items within the tree and drag items between two separate tree instances. The tooltip function receives the data item and returns a string for the hover tooltip.


DHTMLX Tree Features

DHTMLX Tree includes the following main features in the GPL edition.

| Feature | Details | | :---- | :---- | | Unlimited nesting depth | Render hierarchical data with any number of nested levels | | Dynamic data rendering | Efficiently renders large datasets without loading all nodes upfront | | Drag-and-drop reordering | Reorder items within a tree or drag items between two tree instances | | Inline editing | Edit item labels directly in the tree via double-click | | Two-state checkboxes | Attach checkboxes to items; check/uncheck programmatically via API | | Three-state checkboxes | Intermediate state shown when only some children of a parent are checked | | Filtering | Display items matching specified criteria using the TreeCollection filter API | | Sorting | Sort items in ascending or descending order via the TreeCollection sort API | | Expand and collapse | Expand or collapse individual nodes or all nodes at once | | Save and restore state | Serialize and restore the full expand/collapse state of the tree via getState() / setState() | | Custom item templates | Render custom HTML content inside tree nodes via the template configuration option | | Custom icons | Replace default folder and item icons with any icon font pack | | Tooltips | Custom tooltip content per item via tooltip function | | Key navigation | Arrow-key navigation through tree items | | Selection API | Programmatic selection management via the Selection object | | TreeCollection API | Add, update, remove, filter, and sort items at runtime | | Event system | Rich API events for click, double-click, drag, check, expand, and more | | Themes and high-contrast mode | Multiple built-in themes including high-contrast for accessibility | | Accessibility | WCAG-compliant; keyboard navigation and screen reader support |

This table highlights key features. For the complete and up-to-date feature list, see the DHTMLX Tree documentation.


Framework Integration

DHTMLX Tree works with popular front-end frameworks including React, Angular, Vue, and Svelte. These integration guides apply to both the GPL edition and the commercial editions of DHTMLX Tree.


Documentation and Resources