<Gantt> are tasks and links. Together they describe the work items that appear on the chart and the dependency arrows drawn between them.
The task object
Each item in thetasks array must conform to the ITask interface.
Unique identifier for the task. Used by links (
source / target) and the parent field to reference this task.Display label shown on the task bar and in the grid.
Start date of the task. Required for
'task' and 'milestone' types. For 'summary' tasks you can omit this — the component derives it from children.End date of the task. You may supply either
end or duration — the component calculates the missing value. Milestones ignore end.Task length expressed in
durationUnit units (default: days). Provide either duration or end; if both are given end takes precedence.Completion percentage from
0 to 100. Shown as a filled overlay on the task bar.Task type. Built-in values are
'task', 'milestone', and 'summary'. Custom types can be added via the taskTypes prop.id of the parent task. Use 0 (or omit) for root-level tasks. Setting a parent makes this task a child of a 'summary' task.Whether a summary task’s children are initially expanded.
When
true, the summary task will not expand until the user clicks it. Useful for loading children on demand.Task types
Thetype field controls how a task is rendered.
| Type | Description |
|---|---|
'task' | Standard bar task. Default type. |
'milestone' | Diamond-shaped point-in-time marker. Only start is used. |
'summary' | Parent container. Dates roll up from children if not supplied. |
Custom task types
You can define additional types and pass them to thetaskTypes prop. Custom types inherit the default bar rendering but get a distinct CSS class that you can style.
Task hierarchy
Nest tasks by settingparent to the id of a 'summary' task. You can build trees to any depth.
- The
open: truefield on the summary task controls whether children are visible on initial render. - A summary task with no explicit
start/endderives its date range from the earliest childstartand latest childend.
Dates and duration
You can specify a task’s time span in three equivalent ways:- start + end
- start + duration
- end + duration
durationUnit prop (default 'day') tells the component what unit to use when interpreting the duration number. Set it to 'hour' for hour-granularity schedules.
Changing
durationUnit affects how numeric duration values are interpreted and how the duration column is displayed in the grid.Dependency links
Pass an array of link objects to thelinks prop to draw dependency arrows between tasks.
Unique identifier for the link.
id of the predecessor task.id of the successor task.Link type controlling which ends of the task bars are connected.
| Value | Meaning |
|---|---|
'e2s' | End-to-start (finish-to-start) |
's2s' | Start-to-start |
'e2e' | End-to-end (finish-to-finish) |
's2e' | Start-to-end |
Full example
The example below shows a small project with all three built-in task types and severale2s dependency links.
Props reference
Array of task objects to display. Mutating this array reference triggers a re-render.
Array of dependency link objects. Links are drawn as arrows between task bars on the timeline.
Custom task type definitions. Replaces the default list (
task, summary, milestone), so include the built-in types if you still want them.Unit used to interpret numeric
duration values on task objects.