Svelte Gantt Chart

SvGrid has no Gantt mode, and it is worth saying that before you read further. What it has is a grid with custom cells, and a Gantt row is a task on the left and one wide cell on the right whose bar is positioned by percentage of the project span. That is exactly how the demo below is built, in one file you can copy.

If your plan is really a schedule of bookings across resources rather than a work-breakdown structure, the enterprise scheduler timeline is the better fit: it draws real bars on a time axis with drag to re-time and resize. It is deliberately not a project planner though, so there is no critical path, no baselines and no percent-complete roll-up, and none are planned.

Install

npm i @svgrid/grid

Free and MIT-licensed in @svgrid/grid: no license key, no row cap, no watermark.

The code

<script lang="ts">
  import { SvGrid, renderSnippet, type ColumnDef } from '@svgrid/grid'
</script>

{#snippet TimelineCell({ row })}
  <div class="track">
    <div
      class="bar"
      style:left="{((+new Date(row.start) - projectStart) / projectSpan) * 100}%"
      style:width="{((+new Date(row.end) - +new Date(row.start)) / projectSpan) * 100}%"
    ></div>
  </div>
{/snippet}

<SvGrid
  data={tasks}
  columns={[
    { field: 'name', header: 'Task', width: 240 },
    { field: 'end', header: 'Schedule', width: 400,
      cell: (ctx) => renderSnippet(TimelineCell, { row: ctx.row.original }) },
  ]}
/>

What you get

Live examples

Documentation

Related articles

Frequently asked questions

Does SvGrid have a Gantt chart component?

No. There is no Gantt mode or Gantt component. A Gantt view is built as a grid with one wide custom cell per row that positions task bars by date, which is what the example on this page does.

Can I use the scheduler as a Gantt chart?

For resource and booking timelines, yes. The scheduler's timeline views draw bars on a time axis with drag to re-time and resize. It is explicitly not a project planner: no critical path, baselines or work-breakdown structure.

Can tasks have dependencies?

The enterprise scheduler has optional dependencies for ordered bookings, where a job moves through stations in sequence. They are opt-in, and without dependency config the timeline draws no arrows and cascades nothing.

Is it free?

The grid-based Gantt is MIT-licensed in @svgrid/grid. The scheduler timeline alternative needs the commercial @svgrid/enterprise package.

Build something else

Get started · Browse the gallery · Pricing