The Principal Dev – Masterclass for Tech Leads

The Principal Dev – Masterclass for Tech Leads28-29 May

Join

DHTMLX Gantt - JavaScript Gantt Chart (Community Edition)

npm: v.10.0.0 Β· License: MIT Β· made by DHTMLX

Quick start | Build from source | Features | Community vs PRO | Frameworks | License | Links

dhtmlx-gantt is an open-source JavaScript Gantt chart library for visualizing and managing project schedules: a configurable task grid, a zoomable timeline, projects and milestones, four dependency link types, drag-and-drop scheduling, data export, and 32 built-in locales.

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

DHTMLX Gantt - Community (MIT) Edition

This is the Community Edition of DHTMLX Gantt - distributed as the dhtmlx-gantt npm package under the MIT License and shipped as readable source code you can fork, modify, and rebuild. For advanced project management capabilities such as auto-scheduling, critical path, and resource management, see the PRO edition.


Quick start

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

Install

npm install dhtmlx-gantt

Import

With a module bundler (Vite, webpack, Rollup, …):

import { gantt } from "dhtmlx-gantt";
import "dhtmlx-gantt/codebase/dhtmlxgantt.css";

The side-effect import also registers a global gantt, so plain <script> tags work against the bundled files in codebase/:

<script src="codebase/dhtmlxgantt.js"></script>
<link rel="stylesheet" href="codebase/dhtmlxgantt.css">

Add a container

<div id="gantt_here" style="width: 100%; height: 600px;"></div>

Initialize

gantt.config.date_format = "%Y-%m-%d";

gantt.init("gantt_here");

gantt.parse({
    data: [
        { id: 1, text: "Website redesign", type: "project",    progress: 0.4, open: true },
        { id: 2, text: "Research",         start_date: "2026-06-01", duration: 4, parent: 1, progress: 1 },
        { id: 3, text: "Wireframes",       start_date: "2026-06-05", duration: 6, parent: 1, progress: 0.6 },
        { id: 4, text: "Visual design",    start_date: "2026-06-11", duration: 8, parent: 1, progress: 0.2 },
        { id: 5, text: "Launch",           start_date: "2026-06-19", type: "milestone", parent: 1 }
    ],
    links: [
        { id: 1, source: 2, target: 3, type: "0" },  // finish-to-start
        { id: 2, source: 3, target: 4, type: "0" },
        { id: 3, source: 4, target: 5, type: "0" }
    ]
});

See a live demo Β· or run the bundled gallery with npm run start and open /samples/.


Build from source

Unlike a compiled-only distribution, the Community Edition ships its TypeScript/JavaScript sources and LESS styles, so you can read, change, and rebuild the library.

git clone https://github.com/DHTMLX/gantt.git
cd gantt
npm install

npm run build     # builds codebase/dhtmlxgantt.js (+ es module, css, d.ts)
npm run start     # dev mode: watch build + samples server at http://localhost:5173
npm run test      # builds, then loads every sample and fails on console errors
npm run lint      # eslint over src/

codebase/ is build output (generated, not committed). After npm run build you can serve the files from codebase/ directly via <script> tags, exactly like the npm package.

Repository layout

src/        library sources (TypeScript + JavaScript, LESS styles)
samples/    runnable demos (npm run start, then open /samples/)
scripts/    build, dev server, and test runner scripts
codebase/   build output (generated, not committed)

Testing

npm run test                 # smoke test: builds, then loads every sample
npm run test 05_lightbox     # smoke just one samples folder
npm run lint                 # eslint over src/

npm run test is a smoke pass: it loads every built sample headless and fails if any page throws or logs a console.error. It runs the build first; pass --no-build to skip it (e.g. in CI, where the build is a separate step).


Basic usage

Configuring the grid and time scale

// Configure grid columns
gantt.config.columns = [
    { name: "text",       label: "Task",  tree: true, width: 220 },
    { name: "start_date", label: "Start", align: "center", width: 90 },
    { name: "duration",   label: "Days",  align: "center", width: 60 },
    { name: "add",        label: "",      width: 44 }   // add-task button column
];

// Set the time scale unit and step
gantt.config.scale_unit = "week";
gantt.config.date_scale = "%M %d";

// Highlight weekends on the timeline
gantt.templates.scale_cell_class = function (date) {
    if (date.getDay() === 0 || date.getDay() === 6) return "weekend";
};

gantt.init("gantt_here");

Enabling plugins

Activate optional extensions before calling gantt.init():

gantt.plugins({
    tooltip:             true,   // hover tooltips on task bars
    quick_info:          true,   // touch-friendly task popup
    fullscreen:          true,   // fullscreen toggle
    keyboard_navigation: true,   // arrow-key navigation
    drag_timeline:       true,   // drag to scroll the timeline
    click_drag:          true    // draw new tasks by dragging on the timeline
});

gantt.init("gantt_here");

Multiple chart instances

Render several independent Gantt charts on one page with the Gantt factory:

import { Gantt } from "dhtmlx-gantt";

var chartA = Gantt.getGanttInstance();
var chartB = Gantt.getGanttInstance();

chartA.init("gantt_a");
chartB.init("gantt_b");

The default gantt export is itself an instance created this way, so existing single-chart code keeps working unchanged.

Reacting to changes

gantt.attachEvent("onAfterTaskUpdate", function (id, task) {
    fetch("/api/tasks/" + id, {
        method: "PUT",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(task)
    });
});

gantt.attachEvent("onAfterLinkAdd", function (id, link) {
    fetch("/api/links", {
        method: "POST",
        body: JSON.stringify(link)
    });
});

For two-way sync with a REST backend, use the bundled dataProcessor - see Backend integration.


Features

The Community Edition covers the everyday Gantt feature set, including projects (summary tasks) and milestones:

Note: codebase/dhtmlxgantt.d.ts describes the full product API, so it lists some PRO-only methods that are not present in this edition.


Community vs PRO

This edition is intended for schedule visualization and manual editing. Production project-management features - auto-scheduling, critical path, resource planning - are part of the commercial PRO edition.

Feature Community (MIT) PRO
Task grid, columns, tree, inline editing βœ“ βœ“
Zoomable single/dual time scale βœ“ βœ“
Projects / summary tasks, milestones βœ“ βœ“
Four dependency types (FS/SS/FF/SF) + lag βœ“ βœ“
Drag-and-drop scheduling & bar resize βœ“ βœ“
Progress, lightbox editor, templates βœ“ βœ“
Smart rendering for large datasets βœ“ βœ“
Multiple chart instances per page βœ“ βœ“
Tooltips, quick info, keyboard nav, fullscreen βœ“ βœ“
Drag-timeline, click-drag, grid column resize βœ“ βœ“
Skins, 32 locales, accessibility, touch βœ“ βœ“
JSON/XML loading, REST dataProcessor βœ“ βœ“
Export to PDF/PNG/Excel/iCal/MS Project βœ“ βœ“
Auto-scheduling βœ— βœ“
Critical path & slack βœ— βœ“
Resource management (assignments, histogram, grouping by resource) βœ— βœ“
Baselines & deadlines βœ— βœ“
Constraints βœ— βœ“
Split tasks & rollups βœ— βœ“
WBS codes βœ— βœ“
Grouping βœ— βœ“
Dynamic (on-demand) loading βœ— βœ“
Undo / redo βœ— βœ“
Multi-task selection & drag βœ— βœ“
Timeline markers / today line βœ— βœ“
Unscheduled tasks & new-task placeholder βœ— βœ“
Working-time calendars (setWorkTime, custom work calendars) βœ— βœ“

Need advanced project management features?

The DHTMLX Gantt PRO edition adds auto-scheduling, critical path calculation, resource management (assignments, histograms, and grouping by resource), working-time calendars, baselines and deadlines, constraints, split tasks, WBS, and dynamic data loading - capabilities designed for production project-management applications.


Framework integration

DHTMLX Gantt works with popular front-end frameworks. The PRO edition provides ready-made components (ReactGantt, VueGantt, AngularGantt); the Community Edition integrates via the standard wrapper patterns documented below.

Backend integration

The bundled dataProcessor provides two-way data sync between the chart and a REST API:


License

This Community Edition of DHTMLX Gantt is licensed under the MIT License - see LICENSE.md.

You are free to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of this software in any project, including closed-source and commercial applications, subject only to the MIT License terms. It 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.

Copyright Β© 2026 XB Software Ltd.


Documentation and resources

The full product documentation applies to this edition within the feature scope above.

AI-assisted development

Building with an AI coding assistant (Claude Code, Cursor, Codex…)? Two free helpers cover the dhtmlx-gantt package:

If this project helps you, please ⭐ the GitHub repository.

Join libs.tech

...and unlock some superpowers

GitHub

We won't share your data with anyone else.