Vanilla Gantt Technical Docs
Implementation-focused documentation for <vn-gantt>, a task tree shown as
bars on a timeline, with dependency links between them, which the user
reschedules by dragging a bar or with the keyboard. The left pane is an embedded <vn-grid> in tree mode, the
task list; the right pane is the timeline, which draws one bar per row the
grid renders. The two share one frame, with a splitter between them that
resizes the task list. The grid owns vertical scrolling and its row pool; the
timeline follows it, so a plan of 1M tasks scrolls like 1M grid rows.
<vn-gantt>
+-----------------------------+-----------------------------------------------+
| <vn-grid> (tree rows) | October 2026 | November 2026 #| header: 2 tiers, ends
| Task Start End | 12 13 14 15 16 ...| ... #| where the grid's rows begin
+-----------------------------+-----------------------------------------------+
| v Phase 1 10-12 10-30 | [==============================] #| summary bar
| Design 10-12 10-16 | [=========] #| lanes follow the grid's
| Build 10-16 10-30 | [==================] #| rendered rows
+-----------------------------+-----------------------------------------------+
the only vertical scroller ^ splitter horizontal scroller, custom ^ the grid's vertical
scrollbar scrollbar, at the far right
See also the component README for the
public API, and the project-tasks-js sample,
which shows 1,000 to 1,000,000 generated tasks.
Documents
Listed in reading order.
- Getting Started: a step-by-step guide with live examples, for a first Gantt.
- Web Component: attributes,
lifecycle,
ready(), the embedded grid and how it is configured, the load and its events, the stylesheet links, the splitter and the task list's width. - Timeline and Virtualization: following the grid's render passes, input forwarding and touch momentum, the scale and zoom levels, the lane and tick pools, the horizontal scrollbar, the task grid's vertical scrollbar at the timeline's right edge.
- Data Manager: the Gantt DataManager contract, the static manager, the task model (dates, tree, roll-up) and the bad-data rules that keep both panes on the same tree.
- Dependencies: resolving links, the depth-first window index, routing, violation, links into collapsed subtrees and links with a filtered-out end.
- Task Moving: the push and roll-up rules, pointer and touch drag, the commit pipeline and its events, and the Gantt's three tab stops and keyboard selection.
- Themes: the base and theme stylesheets,
the
--vn-gantt-*tokens, onethemeattribute for both panes.
The grid requirement
The Gantt reuses the grid instead of re-implementing it: the task list, its
columns, resizing, sorting, filtering, search, keyboard handling, row pool,
scaled mode and vertical scrollbar are all <vn-grid>'s. It relies on two
grid APIs built for followers: the
viewport API
and tree rows. It also reads
three of the grid's shared utilities at runtime instead of bundling copies:
| Global | Used for |
|---|---|
VanillaGridScheduler |
Read/write batching of the timeline's horizontal scroll pass and its geometry measurement |
VanillaGridYield |
Yielding between chunks of the task model's parse loop |
VanillaGridDateTimeFeature |
parseDateValue(): a task's start and end to epoch ms |
VanillaGridLogger |
normalizeLogger(), so logger: false silences the Gantt as it does the grid |
The grid must therefore be on the page, and load first. Without it,
ready() rejects and initializeGantt() throws, both with an Error whose
code is 'grid-missing'.
A toolbar for the task grid is a separate component,
vanilla-gantt-toolbar:
<vn-gantt-toolbar gantt="<id>"> names the Gantt and links its task grid
once getTaskGrid() returns it. <vn-gantt> knows nothing of it.
Module map
| File | Global | Role |
|---|---|---|
vanilla-gantt-events.js |
VanillaGanttEvents |
Frozen event-name registry |
features/timeline-scale.feature.js |
VanillaGanttTimelineScale |
Pure day arithmetic: zoom levels, day to px, calendar units, tick labels, the padded range, the width cap |
features/tasks.feature.js |
VanillaGanttTasks |
The task model: dates as day numbers, the id map, the tree, depth-first order, roll-up, the grid's parentKeyGetter |
vanilla-gantt.js |
VanillaGantt |
The core class (model, zoom, scrolling, labels), the locale registry and the dev auto-loader |
features/rendering.feature.js |
(VanillaGantt.prototype) |
The lane pool, bars, summary bars, milestones, the tick pool, the loading and error message |
features/scroll-sync.feature.js |
(VanillaGantt.prototype) |
The grid's viewport listener, the lane rewrite on vn-grid-tree-rebuilt, wheel and touch forwarding, touch momentum, pane geometry |
features/scrollbar.feature.js |
(VanillaGantt.prototype) |
The custom horizontal scrollbar |
features/splitter.feature.js |
(VanillaGantt.prototype) |
The splitter between the panes: pointer drag, keyboard, its ARIA values, the fit to the columns (fitTaskListWidth(), double-click), vn-gantt-task-list-resized |
features/dependencies.feature.js |
VanillaGanttDependencies, and VanillaGantt.prototype |
Pure link resolution, window index, routing and draw plan; the SVG link layer |
features/scheduling.feature.js |
VanillaGanttScheduling |
Pure push and roll-up engine: the change set of a move, cycle refusal |
features/task-move.feature.js |
(VanillaGantt.prototype) |
Pointer and touch drag with its preview, the keyboard selection, the commit pipeline, the task double-click from either pane |
data-managers/gantt-data-manager.js |
VanillaGanttDataManager |
The data source contract (base class) |
data-managers/static-gantt-data-manager.js |
VanillaGanttStaticDataManager |
In-memory tasks and dependencies |
vanilla-gantt-element.js |
VanillaGanttElement |
<vn-gantt>: attributes, the embedded grid, the task list's width, the load, stylesheets |
vanilla-gantt.css, themes/vn-gantt-*.css |
Structure; paint per theme | |
vanilla-gantt.d.ts |
Hand-authored declarations; imports the grid's types |
Each JavaScript file carries a Depends on: header, which build.js's
checkModuleLoadOrder() checks against the bundle order, and every bundled
file goes through checkNoDirectConsoleCalls(), like the grid's and the
toolbar's.
Loading and bundling
Development. A page loads the grid's entry script, then the Gantt's:
<script src="../../src/vanilla-grid/vanilla-grid.js"></script>
<script src="../../src/vanilla-gantt/vanilla-gantt.js"></script>
vanilla-gantt.js injects the Gantt's other files as <script async=false>
tags, exactly as vanilla-grid.js does for the grid's (parallel download,
in-order execution), and exposes window.VanillaGanttReady, which resolves
once they have run. Every async=false script of a document executes in
insertion order, so the grid's files, injected first, have all run before the
Gantt's. window.VanillaGanttSkipAutoload = true, or data-skip-autoload on
the script tag, turns the auto-loader off; VanillaGanttReady then resolves
at once.
Production. npm run build writes
dist/vanilla-components/latest/vanilla-gantt/ with vanilla-gantt.bundle.js,
vanilla-gantt.css, themes/ and vanilla-gantt.d.ts. The bundle
concatenates GANTT_BUNDLE_PARTS (in build.js) behind a header that sets
VanillaGanttSkipAutoload. The sample HTML rewrite renames the
vanilla-gantt.js tag to vanilla-gantt.bundle.js in place, so the grid
bundle's tag stays before it, and stamps it with the ?v= token.
Obfuscation. npm run build:obfuscate processes each part on its own
profile. GANTT_BUNDLE_FAST_PATH keeps the hot-path parts on the fast
(terser-only) profile, for the reason the grid's BUNDLE_FAST_PATH documents:
the task model runs per task over up to 1M tasks on every load, and the lane
pass, the tick pool and the scroll sync run inside the grid's render pass. The
grid's set is unaffected.
Top-level names. The minifier keeps top-level names, so every bundle's
top-level class and const share the page's global lexical scope, and a
second declaration of a name throws a SyntaxError when the later script is
instantiated. Every Gantt global and top-level name is VanillaGantt*,
VN_GANTT_* or _vnGantt*. The data managers are VanillaGanttDataManager
and VanillaGanttStaticDataManager, never a second DataManager.
tests/node/gantt-bundle-coexistence.test.js evaluates the grid, toolbar,
resize-box and Gantt sources in one vm context, in bundle order, and fails
on any redeclaration.
Return-type contract
Before initializeGantt() the element shows nothing (its panes are hidden)
and its methods are safe no-ops:
getTaskGrid() and getTask() return undefined, getTaskCount() returns
0, getDateRange() returns undefined, scrollToTask() returns false,
and scrollToDate(), zoomIn() and zoomOut() do nothing. setZoom() and
the zoom property set the zoom attribute, which initializeGantt() reads;
readOnly reflects the read-only attribute at any time.
loadTasksAsync() and reloadDataManager() reject when no DataManager is set,
and loadTasksAsync() also before initializeGantt().
TypeScript declarations
src/vanilla-gantt/vanilla-gantt.d.ts is hand-authored and imports
VanillaGridColumnDef and VanillaGridElement from
../vanilla-grid/vanilla-grid. The build copies it next to the bundle, beside
the grid's own folder, so the import resolves in dist/ too.
tests/types/vanilla-gantt.dts-typecheck.ts compiles against it, and
tests/node/dts-conformance.test.js checks the declared element, data-manager
and event names against the runtime, both directions.