Synertech Web/ui v0.57.5 Site Storybook

Documentation / Charts

GanttChart

Client@synertech/uiOpen in Storybook

Tasks in time, with their dependencies and their milestones. It is a planning component more than a chart: the axis carries no measure, only dates. It does not overlap Calendar, which picks a date and hands it back.

Each row reads a start (start) and an end (end): a Date, a timestamp or an ISO string. A row without an end, or flagged by the milestone field, is a milestone. progress (0 to 1) fills the completed share, dependencies draws an arrow from the end of each predecessor to the start of the task, and group colours the work packages with the palette colours. The axis lands on calendar boundaries (Mondays, the first of the month), never on round numbers of milliseconds.

The “today” line reads the clock by default: pass a date to today to freeze it (server rendering, tests, screenshots) or false to remove it. Client component ("use client").

Examples

Simple schedule

The minimum: a name, a start, an end. Without group, every bar takes the first palette colour.

Open in a tab
import { GanttChart } from "@synertech/ui";

export function Basic() {
  return (
    <GanttChart
      data={[
        { task: "Audit", start: "2026-09-01", end: "2026-09-12" },
        { task: "Maquettes", start: "2026-09-08", end: "2026-09-26" },
        { task: "Intégration", start: "2026-09-21", end: "2026-10-17" },
      ]}
      x={{ key: "task" }}
      start="start"
      end="end"
      today={false}
      title="Refonte du site vitrine"
    />
  );
}

Full project

Coloured work packages (group), progress (progress), dependencies by ID (id + dependencies) and a final milestone; today is frozen on a date.

Open in a tab
import { GanttChart } from "@synertech/ui";

const project = [
  { id: "scope", task: "Cadrage", start: "2026-03-02", end: "2026-03-13", done: 1, lot: "Amont" },
  {
    id: "specs",
    task: "Spécifications",
    start: "2026-03-09",
    end: "2026-03-20",
    done: 1,
    lot: "Amont",
    after: ["scope"],
  },
  {
    id: "design",
    task: "Design",
    start: "2026-03-16",
    end: "2026-04-03",
    done: 0.8,
    lot: "Amont",
    after: ["specs"],
  },
  {
    id: "build",
    task: "Développement",
    start: "2026-03-30",
    end: "2026-05-15",
    done: 0.35,
    lot: "Fabrication",
    after: ["design"],
  },
  {
    id: "qa",
    task: "Recette",
    start: "2026-05-04",
    end: "2026-05-29",
    done: 0,
    lot: "Fabrication",
    after: ["build"],
  },
  {
    id: "launch",
    task: "Mise en production",
    start: "2026-06-08",
    lot: "Déploiement",
    after: ["qa"],
  },
];

export function FullProject() {
  return (
    <GanttChart
      data={project}
      x={{ key: "task" }}
      start="start"
      end="end"
      id="id"
      progress="done"
      dependencies="after"
      group="lot"
      today="2026-04-14"
      todayLabel="Aujourd’hui"
      title="Refonte de l’espace client"
      description="La barre pleine à l’intérieur est la part réalisée"
    />
  );
}

A single day

ISO times are enough: the axis switches to hours on its own. formatDate sets how dates are written in the tooltip and the table.

Open in a tab
import { GanttChart } from "@synertech/ui";

export function Hours() {
  const time = new Intl.DateTimeFormat("fr-FR", { hour: "2-digit", minute: "2-digit" });

  return (
    <GanttChart
      data={[
        { task: "Revue de sprint", start: "2026-03-06T14:00", end: "2026-03-06T15:30" },
        { task: "Rétrospective", start: "2026-03-06T15:45", end: "2026-03-06T16:45" },
        { task: "Planification", start: "2026-03-06T17:00", end: "2026-03-06T18:00" },
      ]}
      x={{ key: "task" }}
      start="start"
      end="end"
      today={false}
      formatDate={(value) => time.format(value)}
      rowSize={36}
      title="Fin de sprint"
      description="Vendredi après-midi"
    />
  );
}

Interactive project tracking

onTaskClick receives the resolved task (dates as timestamps, predecessors in dependsOn); the data table stays reachable behind a button.

Open in a tab
import { useState } from "react";
import { GanttChart, type GanttTask } from "@synertech/ui";

const project = [
  { id: "scope", task: "Cadrage", start: "2026-03-02", end: "2026-03-13", done: 1, lot: "Amont" },
  {
    id: "specs",
    task: "Spécifications",
    start: "2026-03-09",
    end: "2026-03-20",
    done: 1,
    lot: "Amont",
    after: ["scope"],
  },
  {
    id: "design",
    task: "Design",
    start: "2026-03-16",
    end: "2026-04-03",
    done: 0.8,
    lot: "Amont",
    after: ["specs"],
  },
  {
    id: "build",
    task: "Développement",
    start: "2026-03-30",
    end: "2026-05-15",
    done: 0.35,
    lot: "Fabrication",
    after: ["design"],
  },
  {
    id: "qa",
    task: "Recette",
    start: "2026-05-04",
    end: "2026-05-29",
    done: 0,
    lot: "Fabrication",
    after: ["build"],
  },
  {
    id: "launch",
    task: "Mise en production",
    start: "2026-06-08",
    lot: "Déploiement",
    after: ["qa"],
  },
];

export function Tracking() {
  const [task, setTask] = useState<GanttTask | null>(null);

  return (
    <div className="flex flex-col gap-3">
      <GanttChart
        data={project}
        x={{ key: "task" }}
        start="start"
        end="end"
        id="id"
        progress="done"
        dependencies="after"
        group="lot"
        today="2026-04-14"
        domain={["2026-03-01", "2026-06-30"]}
        tableView="toggle"
        startLabel="Début"
        endLabel="Fin"
        progressLabel="Avancement"
        title="Feuille de route T2"
        onTaskClick={setTask}
      />
      {task ? (
        <p className="text-sm text-gray-600 dark:text-gray-300">
          {task.label}
          {task.dependsOn.length > 0
            ? ` attend : ${task.dependsOn.join(", ")}`
            : " ne dépend de rien"}
        </p>
      ) : null}
    </div>
  );
}

API reference

Components

GanttChart

ComponentClient

Tasks in time, with their dependencies and their milestones.

More a planning component than a chart, and it says so: there is no measure on the value axis, only dates. What it shows that a list cannot is the overlap — two tasks running at once, and the arrow saying one of them cannot start until the other is done.

It does not overlap Calendar, which picks a date and hands it back. Nothing is selected here: a schedule is read, and a row that has no width on the time axis is a milestone rather than a day.

The time axis lands on calendar boundaries — Mondays, the first of the month — rather than on round numbers of milliseconds, which is what a decimal tick generator produces when it is pointed at a date.

import { GanttChart } from "@synertech/ui";

Props — GanttChartProps

PropTypeDefaultDescription
data• ChartDatum[] —

One row per task, in the order they are listed.

start• string —

Field holding the start — a Date, a timestamp, or an ISO string.

x• ChartXAxisConfig —

Field holding the name of each task.

actions ReactNode —

Slot on the right of the caption: an export button, a range picker.

A filter that frames several panels belongs in a ChartFilterBar above all of them; this is for what belongs to this panel alone.

barSize number —

Caps the thickness of a bar.

color string —

Colour of the bars when there are no groups.

dependencies string —

Field holding the ids this task waits on, as an array.

The arrows are drawn from the end of each predecessor to the start of the task: what a schedule is read for is rarely a single bar, it is what is blocking it.

description ReactNode —
domain [Date | number | string, Date | number | string] —

Fixes the window shown. Defaults to the span of the tasks, plus air.

emptyState ReactNode —

Replaces the "no data" state: usually an EmptyState saying why, and what to do.

end string —

Field holding the end. A row without one is drawn as a milestone.

endLabel string —
error boolean false

The data could not be loaded.

Never the same thing as having none: a panel that says "no data" after a failed request states something false, and offers no way out.

errorState ReactNode —

Replaces the whole built-in error state, message and button included.

formatDate (value: number) => string —

Formats a date in the tooltip and the data table.

grid boolean true
group string —

Field naming the group a task belongs to. Groups take the palette slots.

height number —
id string —

Field holding a stable id, which the dependencies point at.

legend boolean | ChartLegendPosition —
loading boolean false

Dims the plot while fresh data loads; a first load shows a spinner.

locale string —

BCP 47 tag the numbers and the dates are written in. Defaults to the locale of UILabelsProvider, then to the language of the runtime.

margin Partial<ChartMargin> —
milestone string —

Field marking a row as a point in time rather than a span. A row without an end is one either way.

onRetry () => void —

Draws the retry button in the error state, and is called when pressed.

onTaskClick (task: GanttTask) => void —

Called with the mark that was clicked.

Enter and Space on the focused chart do the same for the mark the keyboard is on.

plotLabel string —
progress string —

Field holding the share completed, from 0 to 1.

progressLabel string —
rowSize number 30

Height of a row. The chart's own height follows from it.

size ChartSize "md"
startLabel string —
tableView boolean | "toggle" false
ticks number 6

Preferred number of ticks on the time axis.

title ReactNode —
today Date | number | string | false —

Marks a moment with a rule. Pass false to leave it out.

todayLabel string —
tooltip boolean | ((task: GanttTask) => ReactNode) true
width number —

+ 275 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).

Types

GanttTask

Interface

One task, as the tooltip and the click handler see it.

interface GanttTask
FieldTypeDefaultDescription
datum• ChartDatum —
dependsOn• string[] —

Ids this task waits on.

end• number | null —

End, as a timestamp. Equal to start on a milestone.

group• string | null —

Name of the group the task belongs to, when there is one.

id• string —

Stable identity, used by the dependencies. Falls back to the row index.

index• number —
label• string —
milestone• boolean —

A point in time rather than a span.

progress• number | null —

Share completed, from 0 to 1. null when the row says nothing.

start• number | null —

Start, as a timestamp. null when the row carries no usable date.

x• ChartXValue —