Gantry
A free, full-featured, open-source Gantt chart for every framework — Angular, React, Vue, Svelte, or plain JavaScript. Interactive editing (drag & resize with mouse, touch and keyboard, cells, links, progress, undo / redo), dependencies, critical path, baselines, virtual scrolling, export to SVG, PNG and CSV, paginated print, theming and i18n — accessible (WCAG 2.2 AA, forced colors), MIT licensed, zero runtime dependencies.


Packages
| Framework | Package | Install | Docs |
|---|---|---|---|
| Angular 22+ | @gantryjs/angular |
npm i @gantryjs/angular |
below |
| React 18 / 19 | @gantryjs/react |
npm i @gantryjs/react |
packages/react |
| Vue 3.5+ | @gantryjs/vue |
npm i @gantryjs/vue |
packages/vue |
| Svelte 5 | @gantryjs/svelte |
npm i @gantryjs/svelte |
packages/svelte |
| Vanilla JS / any | @gantryjs/vanilla |
npm i @gantryjs/vanilla |
packages/vanilla |
| Framework-free logic | @gantryjs/core |
npm i @gantryjs/core |
packages/core |
@gantryjs/core types · timeline math · tree helpers · critical path (no DOM, no framework)
├── @gantryjs/angular native Angular components (signals, zoneless)
└── @gantryjs/vanilla <gantry-element> Web Component
├── @gantryjs/react
├── @gantryjs/vue
└── @gantryjs/svelte
Quick start (any framework)
// React
import { Gantry, ViewMode } from '@gantryjs/react';
<Gantry tasks={tasks} options={{ viewMode: ViewMode.Week }} onTaskDragged={e => save(e)} />;
<!-- Vue — import { Gantry, ViewMode } from '@gantryjs/vue' -->
<Gantry :tasks="tasks" :options="{ viewMode: ViewMode.Week }" @task-dragged="save" />
<!-- Svelte — import { Gantry, ViewMode } from '@gantryjs/svelte' -->
<Gantry {tasks} options={{ viewMode: ViewMode.Week }} onTaskDragged={save} />
<!-- Plain HTML / any framework -->
<gantry-element id="gantt"></gantry-element>
<script type="module">
import '@gantryjs/vanilla';
const gantt = document.getElementById('gantt');
gantt.tasks = [{ id: '1', name: 'Design', start: new Date('2026-01-05'), end: new Date('2026-01-20'), progress: 40 }];
gantt.addEventListener('task-dragged', e => console.log(e.detail));
</script>
Configuration
Every binding (Angular [options], React / Vue / Svelte options, <gantry-element>.options)
takes the same GanttOptions object, and both renderers draw from the same @gantryjs/core
render model — an option behaves identically everywhere. Try them all live in the
playground — the site's /playground (pnpm start) or the Web Component one
(pnpm dev:vanilla).
Each binding documents the rest of its API in its own README:
- Web Component
<gantry-element>(the React, Vue and Svelte wrappers forward to it): properties, attributes, events, methods, slots, keyboard and focus, CSS custom properties, parts, custom states and Content Security Policy. The package ships a Custom Elements Manifest (custom-elements.json) for IDEs, Storybook and linters. - Angular
<gantry>: Inputs & Outputs, Public API, content slots and Theming.
Keyboard, touch, zoom, screen-reader and forced-colors behaviour is the same in every binding: see Keyboard and focus, Touch and pointer, Zoom, Screen readers and Forced colors below.
On this page: Timeline · Week numbering · Non-working time · Working calendar · Resources · Bars · Task styles · Rollup · Panel and table · Responsive and density · Toolbar · Tooltip · States · Synchronised charts · Editing · Export and print · Dates and locales · Theming · Styling hooks · CSP · SSR · Examples.
Timeline, header tiers and zoom
import { ViewMode, WEEK_FORMATS } from '@gantryjs/core';
options = {
viewMode: ViewMode.Week, // Hour · Day · Week · Month · Quarter · Year, or a custom level name
weekStart: 1, // 1 = Monday (ISO weeks), 0 = Sunday
scales: [
// header tiers, top → bottom (any number)
{ unit: 'month', format: 'MMMM YYYY' },
{ unit: 'week', format: WEEK_FORMATS.rangeMonth }, // "4–11 Mar"
],
zoomLevels: [
// replace the built-in presets
{ name: 'Sprint', cellWidth: 120, scales: [{ unit: 'month' }, { unit: 'week', step: 2, format: '[W]W' }] },
],
gridLines: {
major: { color: '#94a3b8', width: 1.5, dash: '4 3' }, // period delimiters (header + body)
minor: { width: 1 }, // between cells; `false` hides
horizontal: false, // row separators
majorUnit: 'month', // default: the tier above the bottom one
},
headerHeight: 32,
subHeaderHeight: 28,
fitToWidth: true, // the timeline always fills the viewport
initialScroll: 'auto', // 'auto' · 'today' · 'start' · a Date · false
};
unit:hour·day·week·month·quarter·year;stepgroups cells (6 hours, 2 weeks…).format: a dayjs-compatible format string ('MMM YYYY','[W]W','ddd D', see date formats) or(start, end, ctx) => string.- Week presets:
WEEK_FORMATS.number(W52),.label(Week 52),.range(4–11),.rangeMonth(4–11 Mar),.numberRange(W52 · 4–11). className: (start, end) => stringadds your own class to header cells.- Upper-tier labels stay pinned to the left while scrolling (
align: 'start'). A cell cut by the edge of the range shows no label when it is narrower than its label + 12 px, so no clipped slivers. initialScrollpicks where the first render with data scrolls:'auto'(default) centres today when it is near the tasks, otherwise shows the earliest task;'start'the earliest task;'today'or aDatecentred;falsestays at the timeline start. Changing it re-applies it. Zooming from the toolbar, the keys orzoomIn()/zoomOut()keeps the date at the centre of the viewport in place, zoom gestures the date under the pointer (see Zoom), andprefers-reduced-motionturns smooth scrolling into an instant jump.
Week numbering
options = {
weekNumbering: 'us', // 'iso' · 'us' · 'locale'
weekStart: 6, // 1 = Monday, 0 = Sunday, 6 = Saturday; overrides the rule's first day
};
'iso': weeks start on Monday and week 1 holds 4 January (the default).'us': weeks start on Sunday and week 1 is the week that holds 1 January.'locale': the rule ofoptions.locale(Intl.Locale#getWeekInfo(), else ISO).- Unset,
weekNumberingis'us'whenweekStartis0, otherwise'iso'. Charts that set neither keep their ISO weeks. - Under the US rule the days of the week that holds 1 January are week 1 of the new year, even
when they fall in December: Sunday 27 December 2026 reads
W1, notW53. - Week cells start on
weekStart, and theW/WWtokens andWEEK_FORMATSfollow the rule. Core exportsweekOfYear(date, rule),weekYear(date, rule)and the rulesISO_WEEK,US_WEEK.
Non-working time (weekends, holidays, working & intensive hours)
options = {
nonWorkingTime: {
weekends: true, // or weekday numbers, e.g. [5, 6]
holidays: [new Date(2026, 11, 25), { start: d1, end: d2, label: 'Shutdown', color: '#fee2e2' }],
workingHours: { start: 9, end: 18 }, // or per weekday: { 1: [{ start: 9, end: 13 }, { start: 14, end: 18 }] }
intensiveHours: [{ start: 10, end: 12, label: 'Focus', color: 'rgba(245,158,11,.2)' }],
style: 'shade', // 'shade' (tinted by kind) | 'hatch' (+ stripes) | 'disabled' (one neutral grey) | 'none' (no band)
showInHeader: true,
minPxPerDay: 12, // hide day shading in dense zoom levels
},
highlightTime: (start, unit) => (isRelease(start) ? { color: '#dcfce7', label: 'Release' } : null),
};
Shading is visual only until you turn on the working calendar, which counts durations in the
same working time; without it durations stay in calendar days. Colours default to the theme
(weekendBg, holidayBg, offHoursBg, intensiveBg). nonWorkingTime: false turns it off.
style: 'none' keeps the definition but paints no weekend, holiday or off-hours band (intensive hours and
highlightTime still paint), so a chart can count working time without the stripes.
Working calendar
Durations count calendar days unless you turn on calendar. Then the same weekends, holidays and working hours
that nonWorkingTime shades also drive the arithmetic: durations, drags, cells, the critical path and its float
count working time, so a bar dragged across a weekend keeps its working days and stretches over the days off.
options = {
calendar: true, // = { durations: 'working', unit: 'day', skipNonWorking: true, hoursPerDay: 8 }
nonWorkingTime: { holidays: [new Date(2026, 11, 25)] }, // Saturday and Sunday are off unless you say otherwise
panel: { columns: ['name', 'start', 'end', 'duration'] },
};
| Option | Default | Effect |
|---|---|---|
calendar |
off | true is {}. Off (unset or false) is today's behaviour exactly: calendar days, nothing snapped |
calendar.durations |
'working' |
What durations count: 'working' time, or 'calendar' days (texts as without a calendar; skipNonWorking still applies) |
calendar.unit |
'day' |
'day': a working day is a whole day. 'hour': working time is the hours of nonWorkingTime.workingHours, 09:00–17:00 when you set none |
calendar.skipNonWorking |
true |
Edits never start or end a task on non-working time: starts move forward, ends back |
calendar.hoursPerDay |
8 |
With unit: 'hour': the working hours that make 1d in texts and typed durations (above 0, up to 24). It doesn't change the hours themselves |
- One definition. The calendar is built from the resolved
nonWorkingTime— the weekends (Saturday and Sunday by default), holidays andworkingHoursthe chart shades — so shading and arithmetic can't disagree.nonWorkingTime: falsewith a calendar means no non-working time at all (every day, and withunit: 'hour'every hour). A week with no working time (every weekday a weekend, orunit: 'hour'with no hours) turns the calendar off. - Hours. With
unit: 'hour'a working day is itsworkingHoursranges (one range, a list, or a per-weekday map; a weekday missing from the map has no hours; weekends and holidays always win), counted on the wall clock. The default 09:00–17:00 is the hours that are shaded too.
What counts working time
A "measured day" is a working day (with unit: 'hour': working hours ÷ hoursPerDay). With
durations: 'working' they are what these show and use:
- the Duration column (text and sort), the tooltip's duration, the drag readout, and the variance column and tooltip row (signed, from the planned to the actual end);
- the duration cell (its text, what you type and the end it writes), the start cell (it keeps the working length) and predecessor lags;
rollup.progress: 'duration'weights, and the CSVdurationandvariancedata values;- the critical path: durations,
GanttDependency.lagand float.
Texts read "1 day", "5 days" (never weeks: a working week isn't 7 days) and, in an hour calendar, "6 hours" under
one day (labels.durationHours); the tooltip's float reads "2d" or "5h" (labels.ttFloatDays, labels.ttFloatHours).
A typed duration or lag takes d (a measured day), w (the working week: the weekdays with working time, 5 by
default, 7 with durations: 'calendar') and h (an hour of the working day: 1 / hoursPerDay with unit: 'hour',
else 1 / 24). The cell shows it back as 5d, 1.5d or 12h (in an hour calendar whole days 2d, else hours 20h).
Not changed: the bars (a bar covers the days off it spans), the arrow lag labels (+2d), the event amounts
(daysMoved is the real calendar shift of the start) and the announcements ("Design moved 3 days later").
Editing
Only gestures and cells are snapped (skipNonWorking), never your data: tasks, updateTask(), appendTasks(),
the API, undo and redo draw what you give, a task that starts on a holiday keeps it until it is edited, and
validation never rejects a non-working date (do that in editing.validate, whose context has calendar: a
WorkingCalendar or null).
| Edit | What happens |
|---|---|
| Drag a bar | The start moves by the pointer's snap units and snaps forward to where working time begins; the end keeps the working length (the bar widens over days off) |
| Resize an edge | The edge moves by the snap units; a start snaps forward, an end back to right after working time. With working durations the task never gets shorter than one snap unit of working time (on a day scale of an hour calendar: the working hours of the edges' weekdays, up to hoursPerDay; durations: 'calendar': only the usual minimum width) |
| Move mode (← →, Shift / Alt) | Each key press moves, or resizes, by one unit of working time (a working day; an hour on hour scales): no dead key over a weekend |
| Start cell | The start snaps forward; the end follows the working length |
| End cell | The end snaps back; an end before the start is an error, as before |
| Duration cell | Sets the end from the start, not snapped: 3d reads 3d |
With durations: 'calendar' a moved bar keeps its calendar length, and with skipNonWorking its end snaps back so
it never ends on a day off (Monday–Tuesday moved to Friday ends on Saturday 00:00). With durations: 'calendar'
and skipNonWorking: false nothing is snapped, as without a calendar. A move that keeps the working length is one task-dragged (no task-resized) and one undo step.
Dates. A bar is measured on what it draws: date-only values are local days, and with the default
endDateMode: 'exclusive' a Monday–Friday task ends on Saturday 00:00 ('inclusive': on Friday). Edited dates keep
the task's own form: a date-only value stays date-only and an inclusive end stays inclusive. In an hour calendar
the results carry times, so a date-only task edited there gains its working hours.
Critical path, float and Node
criticalPath: true computes the path in working time, so its chain can differ from the calendar-day one (the
gallery's Critical path in working time case flips it with its Durations control). The tooltip shows the float of the tasks off
the path. Headless, pass the resolved config:
import { computeCriticalPath, createWorkingCalendar, formatDuration, resolveConfig } from '@gantryjs/core';
const options = { calendar: true, nonWorkingTime: { holidays: [new Date(2026, 9, 21)] } }; // Wed 21 Oct 2026
const calendar = createWorkingCal

