Installation
Usage
import { GanttChart } from "@/components/gantt-chart"
export function LaunchPlan() {
return (
<GanttChart
title="Team plan launch"
criticalTo="Team plan live"
defaultShowCritical
defaultTasks={[
{ id: "api", name: "Billing API", group: "Build", start: "2026-11-16", days: 9, progress: 30, assignee: "James Walker" },
{ id: "card", name: "Plan card", group: "Build", start: "2026-11-18", days: 6, assignee: "Hugo Tanaka" },
{ id: "qa", name: "QA & fixes", group: "Launch", start: "2026-11-25", days: 4, dependsOn: ["api", "card"] },
{ id: "live", name: "Team plan live", group: "Launch", start: "2026-11-29", days: 0, dependsOn: ["QA & fixes"] },
]}
/>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tasks / defaultTasks | GanttTask[] | [] | Kept by you or by the component. A task has id, name, start ("2026-11-16"), days (0 for a milestone), and optional group, progress (percent), assignee, colour and dependsOn (ids or names). |
| onTasksChange | (tasks, change) => void | — | Called after a move, resize, link or unlink with the change and the ids of tasks that moved with it. |
| title | string | — | A heading for the plan. |
| zoom / defaultZoom | "day" | "week" | "month" | "week" | The scale; onZoomChange tells you when it changes. |
| showCritical / defaultShowCritical | boolean | false | Shows the chain of tasks that sets the end date. |
| criticalTo | string | the last task | The task (id or name) the critical path leads to. |
| canChange | (change) => boolean | — | Veto a change, for example a task that is already done. |
| readOnly | boolean | false | Look and select, but no moving, resizing or linking. |
| locale / label | string | "en-US" / "Project plan" | How dates are written, and the accessible name. |
Accessibility
- Every task is a button named with its dates, length, progress and whether it is on the critical path.
- Left and Right move a task by a day; with Shift they change its length. Tasks that wait move along, and nothing moves before what it waits for ends.
- Every change is announced through a polite live region, and Ctrl or Cmd Z or the toast's Undo takes it back.
- Groups fold with a button that says how many tasks it hides; zoom buttons say which one is on.
- Under prefers-reduced-motion nothing slides or pulses.
Changelog
- v1.0.0Latest
First release.