Svelte Gantt Chart
A Gantt chart is a data grid that draws its rows as bars on a time axis. SvGrid treats it exactly that way: same <SvGrid>, same data, same columns, one extra gantt prop. A parent field nests the rows into phases that draw a rolled-up bar, a dependency list draws the arrows between them, and the task table beside the chart is the grid itself, so search, sort and filter apply before a bar is drawn.
Dragging a bar does not mutate anything behind your back. The chart raises onTaskMove with the task and its new dates, pushes its successors forward through onDependenciesChange, and you write the rows. The planning layer is the part a table cannot fake: the critical path ringed in red with a slack column in working days, baseline ghosts where the plan drifted, constraints the cascade stops at, and a resource load strip that turns red past capacity.
Turn it on: gantt={{ startField: 'start', endField: 'end' }}
Install
npm i @svgrid/grid @svgrid/enterpriseThe grid and its data model are MIT-licensed in @svgrid/grid; this view ships in the commercial @svgrid/enterprise package and runs unlicensed while you evaluate.
The code
<script lang="ts">
import { SvGrid } from '@svgrid/grid'
import { enableGanttView } from '@svgrid/enterprise'
enableGanttView()
let data = $state([
{ id: 'p1', name: 'Discovery', parentId: null, start: '2026-09-07' },
{ id: 't1', name: 'Interviews', parentId: 'p1', start: '2026-09-07', end: '2026-09-11', progress: 100 },
{ id: 't2', name: 'Synthesis', parentId: 'p1', start: '2026-09-14', end: '2026-09-18', progress: 40 },
])
const columns = [
{ field: 'name', header: 'Task' },
{ field: 'start', header: 'Start' },
{ field: 'end', header: 'Finish' },
]
</script>
<SvGrid {data} {columns} getRowId={(r) => r.id}
gantt={{
startField: 'start', endField: 'end', parentField: 'parentId', progressField: 'progress',
dependencies: [{ id: 'd1', from: 't1', to: 't2' }],
}} />What you get
- Phases roll up - parentField nests flat rows into a work-breakdown tree. A phase draws a summary bar spanning its tasks with a percent weighted by duration, and folds with a chevron.
- Links, drawn and enforced - FS, SS, FF and SF links with lag draw as arrows. Move a task and its successors slide forward over weekends and holidays; a link that would close a cycle is refused.
- Drag, resize, undo - Drag a bar or an edge, drag the diamond to set percent, drag a dot onto another bar to link. Every gesture is a callback; Ctrl+Z replays them backwards.
- The critical path - Forward and backward passes in working time ring the chain with no slack, and a __slack column says how many working days of room every other task has.
- Baselines, constraints, resources - Ghost bars show the dates the plan was signed off with, a pin marks a date a task is held to, and a load strip counts who is booked past capacity.
- Still a grid - Toggle the gantt prop off and the full table is back with every column feature. The same rows can feed the scheduler and the Kanban board too.
Live examples
- Project plan - A 14-week release as a Gantt: phases nest their tasks and draw a rolled-up summary bar, finish-to-start links draw as arrows, and a violated one turns red. Collapse a phase and its summary keeps the span. Toggle to the Table - same grid rows, just a view. The renderer ships in @svgrid/enterprise.
- Plan editing - The same plan with editing on: drag a bar or its edges, drag the diamond to set percent, drag a dot onto another bar to draw a link. A phase moves its whole subtree in one callback, successors slide forward over weekends, a cycle is refused, and Ctrl+Z replays it backwards. A log panel lists every write-back the view asks for.
- Critical path & baselines - A fit-out schedule with the planning layer on: the chain with no slack ringed in red with its arrows, a Slack column for everything else, baseline ghosts that redden where the plan has drifted, and two pinned tasks where a cascade stops at the constraint instead of running past it.
- Resource load & folded axis - A field-service quarter with a load strip under the chart: one row per crew, one bar per column, red where a crew is booked past its capacity - the specialist is one person with two sign-offs in the same week. Capacity is per resource, so a two-van crew takes two jobs at once. Fold the weekends out and the quarter fits in the width a month used to take.
- One plan, four views: Grid, Gantt, Scheduler, Kanban - One <SvGrid>, one array, four renderers behind a switch: the plain table with inline editing, the Gantt with phases and links, a resource timeline with a lane per owner, and a Kanban of status lanes. Every view writes back through a callback to the same rows - change a status in the grid and the card moves lane, drag a bar in the Gantt and the timeline follows - and a line under the switcher names the last write.
- Product roadmap - a year in quarters - The Gantt as a roadmap: three teams, their initiatives across four quarters, and the releases that cut across them as milestones. A `task` snippet draws the owner and a status chip inside each bar, colour is by status, a custom tooltip carries the effort and a summary, the header chips filter by status, and a month / quarter / year zoom ladder drills in with Ctrl+wheel.
- A programme of 40 sites, 640 tasks - A fibre roll-out at programme scale: 40 sites, each a phase of 16 linked tasks, 640 tasks and 600 links, opening folded to one bar per site. Rows past the viewport are not rendered, the critical path over every chain names the site the finish date turns on, baselines count the sites running late, and the search box filters the whole thing. Ctrl+wheel to the week preset and the weekends fold out of the axis.
- Portfolio office - project console - A PMO console with the Gantt as the hero: a rail of projects with health and percent complete, live KPIs, and a dockable workspace (SvDockManager) with the plan over a risk register and a remaining-work chart. The plan runs with the critical path and baselines on and is editable; drag a task and the register, the chart and the KPIs recompute from the same rows.
- Gantt chart - Project plan with a wide custom Schedule cell: bars positioned by start/end %, phase coloring, progress fill, today line, overdue glow.
Documentation
- Gantt chart mode - Set one gantt prop and the grid renders its rows as a task table beside a time chart: one bar per row, placed by its start and finish, nested into a…
- Gantt: getting started - The one option a Gantt needs, how it reads your dates, what a bar, a milestone and a summary look like, and the task table beside the chart. The other Gantt…
- Gantt: critical path, baselines and constraints - The planning layer: the chain of tasks with no slack, the dates the plan was signed off with, and the dates a task is pinned to. All three are Enterprise…
- The same rows as a grid, a scheduler and a board - The Gantt is one of four ways the grid can render a set of rows. The others are the table itself, the scheduler and the Kanban board, and all four are the…
Related articles
- Building a Project / Task Board with a Svelte Data Grid - How to build a task management grid with grouping by status or assignee, inline edits, subtask tree rows, and saved views - without reaching for a dedicated project management tool.
Frequently asked questions
How do I build a Gantt chart in Svelte 5?
Give <SvGrid> your rows and columns and set the gantt prop with the field holding each task's start, for example gantt={{ startField: 'start', endField: 'end' }}. Add parentField for phases and a dependencies list for arrows. The renderer is registered once with enableGanttView() from @svgrid/enterprise.
Is the Gantt chart free?
The grid, the gantt prop and its config types are MIT-licensed in @svgrid/grid. The Gantt renderer ships in the commercial @svgrid/enterprise package, which runs unlicensed with a small watermark while you evaluate it. The free recipe on this page, a timeline drawn in one custom cell, needs no license.
Does it have a critical path, baselines and dependencies?
Yes. criticalPath rings the chain with no slack and fills a slack column in working days; baselineStartField and baselineEndField draw the agreed dates as ghost bars; dependencies draws finish-to-start, start-to-start, finish-to-finish and start-to-finish links with lag, and a moved task cascades its successors.
Can I switch between the Gantt and a table?
Yes, and that is the point of the design. The Gantt is a view of the same grid, so toggling the gantt prop on and off swaps between bars and rows with no data changes. The same rows can also feed the scheduler for a resource timeline and the board prop for a Kanban.