Skip to main content

Gantt Pro

A project's tasks on a timeline: bars from start to end with the done part filled in, milestones as diamonds, arrows from each task to those waiting on it, weekends shaded and a dashed line at today. Drag a bar to move it or its end to stretch it, in whole days, with a live preview. Days, weeks or months across, with the task names beside.

import { Gantt } from '@patine-ui/pro';
Loading…
<Gantt tasks={tasks} onTasksChange={setTasks} style={{ width: '100%' }} />

Try the props​

Props
design
<Gantt tasks={tasks} onTasksChange={setTasks} />

Example: an office move​

An office move planned by the week: tasks depend on each other, the list shows who owns each, and pressing a bar shows its dates. Drag a bar to reschedule it.

Loading…
<View style={{ width: '100%', gap: 8 }}>
  <Gantt
    tasks={tasks}
    onTasksChange={setTasks}
    defaultScale="week"
    onTaskPress={(t) => setPicked(`${t.name}: ${t.start.toLocaleDateString()} – ${t.end.toLocaleDateString()}`)}
  />
  <Text size="sm" color="textSecondary">{picked || 'Press a bar for its dates.'}</Text>
</View>

Tasks​

A task is { id, name, start, end, progress?, dependencies?, color?, milestone?, assignee?, locked?, data? }. end is the last day, included. A milestone is a single day drawn as a diamond. dependencies lists the tasks that must finish first, drawn as arrows from their end into this task's start.

Editing​

onTasksChange(tasks, change) gets the new tasks after each move: set them as tasks, or use defaultTasks. onTaskChange(change) is the place to save: { task, start, end, kind }, where kind is 'move' or 'resize'. editable={false} makes the chart read-only; a locked task stays put. A tap opens a task with onTaskPress.

Scales​

scale is 'day', 'week' or 'month' (controlled with onScaleChange, or defaultScale), with a switch above unless showScaleSwitch={false}. columnWidth sets a column's width. The range is the tasks' span padded by the scale; startDate and endDate fix it.

Loading…
<Gantt tasks={roadmap} defaultScale="month" editable={false} listWidth={180} style={{ width: '100%' }} />

Accessibility​

Each bar is a button read as "Build, Mar 9 to Mar 20, 40% done" (or "Launch, milestone, Mar 23"), with a hint on how to move it. Dragging needs a pointer, so the same moves are screen-reader actions (a day earlier or later, a day shorter or longer) and, on the web, arrow keys and Shift + arrow keys on the focused bar.

Props​

PropTypeDefaultDescription
tasks / defaultTasksGanttTask[][]See Tasks.
onTasksChange(tasks, change) => void—
onTaskChange(change) => void—
onTaskPress(task) => void—
scale / defaultScale / onScaleChange'day' | 'week' | 'month''day'
showScaleSwitchbooleantrue
columnWidthnumberday 40, week 96, month 140
rowHeightnumber44
showList / listWidthboolean / numbertrue / 200Task names beside the chart.
editablebooleantrueDrag and keys.
showDependencies / showProgressbooleantrue
startDate / endDateDatethe tasks' span
now / locale
renderBarLabel(info) => ReactNode—
loading / error / onRetry / emptyTitle / renderEmptyStates.
density / labels / design / theme / accessibilityLabel / style

Time runs left to right in every language for now.