Examples

Release plan

Parent rows show the span of their tasks; dependency arrows run from finish to start. A task that starts before what it depends on finishes is marked, in colour and in text.

Preview
Task
Start
End
Done
Depends on
Schedule
Discovery
100%
Mon, Mar 3, 2031 to Thu, Mar 6, 2031, 100% done
Build
Fri, Mar 7, 2031 to Thu, Mar 20, 2031
API
60%
Discovery
Fri, Mar 7, 2031 to Thu, Mar 13, 2031, 60% done
Web app
30%
Discovery
Mon, Mar 10, 2031 to Tue, Mar 18, 2031, 30% done
QA
0%
API
Mon, Mar 17, 2031 to Thu, Mar 20, 2031, 0% done
Launch
QA, Web app
Milestone, Mon, Mar 24, 2031
Arrow keys move between cells. On a schedule cell, Alt plus left or right arrow moves the task a day; Alt plus Shift plus left or right arrow changes its end. On a task name, right arrow expands and left arrow collapses.
Example.tsx
import { Gantt, type GanttTask } from '@reactloom/scheduler';
import { useState } from 'react';

const at = (day: number) => new Date(Date.UTC(2031, 2, day));
const plan: GanttTask[] = [
  { id: 'discovery', title: 'Discovery', start: at(3), end: at(7), progress: 1 },
  { id: 'build', title: 'Build', start: at(7), end: at(21) },
  { id: 'api', title: 'API', start: at(7), end: at(14), progress: 0.6, parentId: 'build', dependencies: ['discovery'] },
  { id: 'web', title: 'Web app', start: at(10), end: at(19), progress: 0.3, parentId: 'build', dependencies: ['discovery'], color: 'var(--pl-color-chart-2)' },
  { id: 'qa', title: 'QA', start: at(17), end: at(21), progress: 0, parentId: 'build', dependencies: ['api'], color: 'var(--pl-color-chart-3)' },
  { id: 'launch', title: 'Launch', start: at(24), end: at(24), milestone: true, dependencies: ['qa', 'web'] },
];

// Tab to the grid. On a schedule cell, Alt + ← / → moves the task and Alt + Shift + ← / → changes
// its end; or drag a bar or its end. Moving QA before API finishes marks the conflict in text.
export default function Example() {
  const [tasks, setTasks] = useState(plan);
  return (
    <div style={{ width: '100%' }}>
      <Gantt
        aria-label="Release plan"
        tasks={tasks}
        timeZone="UTC"
        rangeStart={at(1)}
        rangeEnd={at(26)}
        dayWidth={28}
        onTaskChange={({ task, start, end }) => setTasks((list) => list.map((t) => (t.id === task.id ? { ...t, start, end } : t)))}
      />
    </div>
  );
}

Read-only

Without onTaskChange the chart is a navigable table.

Preview
Task
Start
End
Done
Depends on
Schedule
Site survey
100%
Tue, Apr 1, 2031 to Thu, Apr 3, 2031, 100% done
Permits
50%
Site survey
Fri, Apr 4, 2031 to Fri, Apr 11, 2031, 50% done
Ground works
Permits
Sat, Apr 12, 2031 to Sat, Apr 19, 2031
Handover
Ground works
Milestone, Mon, Apr 21, 2031
Arrow keys move between cells. On a schedule cell, Alt plus left or right arrow moves the task a day; Alt plus Shift plus left or right arrow changes its end. On a task name, right arrow expands and left arrow collapses.
Example.tsx
import { Gantt, type GanttTask } from '@reactloom/scheduler';

const at = (day: number) => new Date(Date.UTC(2031, 3, day));

// Without onTaskChange the chart is read-only: a navigable table with a visual schedule.
export default function Example() {
  const tasks: GanttTask[] = [
    { id: 'survey', title: 'Site survey', start: at(1), end: at(4), progress: 1 },
    { id: 'permits', title: 'Permits', start: at(4), end: at(12), progress: 0.5, dependencies: ['survey'] },
    { id: 'works', title: 'Ground works', start: at(12), end: at(20), dependencies: ['permits'] },
    { id: 'handover', title: 'Handover', start: at(21), end: at(21), milestone: true, dependencies: ['works'] },
  ];
  return (
    <div style={{ width: '100%' }}>
      <Gantt aria-label="Site plan" tasks={tasks} timeZone="UTC" dayWidth={22} />
    </div>
  );
}

API reference

Gantt props
PropTypeDefault
tasksrequired
{ id, title, start, end, progress?, parentId?, dependencies?, milestone?, color? }. End is exclusive; dependencies are finish-to-start.
GanttTask[]—
aria-labelrequired
string—
onTaskChange
kind 'move' or 'resize'. Update your tasks to apply it; reschedule dependants yourself if you want them to follow.
({ task, start, end, kind }) => void—
onTaskSelect
Enter on a schedule cell, or a click on a bar.
(task) => void—
timeZone
Days are counted in this IANA time zone. Default: the browser’s.
string—
dayWidth
Width of a day in px.
number32
rangeStart · rangeEnd
Default: the tasks’ span with two days either side.
Date—
defaultExpandedIds
Parents open at first. Default: all.
string[]—
height
Scroll area.
number | string—
messages
Translate column names, summaries and announcements.
Partial<GanttMessages>—

Customization

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-align]present when on
[data-conflict]present when on
[data-dragging]present when on
[data-expanded]present when on
[data-leaf]present when on
[data-milestone]present when on
[data-schedule]present when on
[data-summary]present when on
[data-today]present when on

Theme tokens it reads

--pl-color-accent-fg --pl-color-accent-solid --pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-subtle --pl-color-danger-solid --pl-color-fg-default --pl-color-fg-muted --pl-focus-ring-color --pl-focus-ring-width --pl-font-size-sm --pl-font-size-xs --pl-radius-md --pl-radius-sm

Accessibility

  • The chart is a treegrid: each task is a row with its level, position and expanded state; every column has a header.
  • The bars, milestones, today line and arrows are hidden from assistive technology because each schedule cell says the same in text: the dates, progress and any dependency conflict.
  • Moves and resizes are announced with the new dates; focus stays on the task.
Keyboard interactions
KeyAction
← → ↑ ↓Move between cells
Home / End · Ctrl + Home / EndFirst / last cell in the row / chart
→ / ← (task name)Expand / collapse, or go to the parent
Alt + ← / → (schedule)Move the task a day earlier / later
Alt + Shift + ← / → (schedule)End the task a day earlier / later
Enter (schedule)Select the task

Usage guidelines

Do

  • Keep the plan in your state and decide how dependants follow a move.
  • Give milestones a short, distinct name.

Don’t

  • Don’t rely on the bar colours alone: put status in the task name or progress.