Tasks & dependencies
Task dates, hierarchy, baseline plans, and scheduling links.
Usage
import type { GanttTask, TaskDependency } from "@art-tools/react-gantt";
const tasks: GanttTask[] = [
{ id: "design", name: "Design", startDate: new Date(2026, 0, 5), duration: 3 },
{ id: "build", name: "Build", startDate: new Date(2026, 0, 8), duration: 5 },
];
const dependencies: TaskDependency[] = [
{ from: "design", to: "build", type: "FS", lag: 0 },
];- endDate is exclusive: a Monday-through-Friday task ends at Saturday 00:00. An explicit endDate takes precedence over duration. Milestones and zero-duration tasks represent instants.
- duration uses the chart's durationUnit, which defaults to day. The library derives dates from duration and does not rewrite the input duration field. progress is a percentage from 0 to 100.
- type defaults to task. Use milestone for an instant and summary for a parent whose dates and progress roll up from children. parentId links a child to its parent; omit it or use null for a root.
- Baselines are consumer-owned snapshots. Only the first five entries per task are considered for display. Their endDate is required for tasks and summaries and omitted for milestones. baselineLayout defaults to height 4px, padding 1px, and gap 2px.
- Dependency from/to values are task IDs. FS means finish-to-start, SS start-to-start, FF finish-to-finish, and SF start-to-finish. lag uses durationUnit and counts working time when a calendar is supplied.
GanttTask
Type| Property | Type & description |
|---|---|
idRequired | Id |
nameRequired | string |
startDateRequired | Date |
endDateOptional | Date |
durationOptional | number |
progressOptional | number |
typeOptional | GanttTaskType |
parentIdOptional | Id | null |
baselinesOptional | GanttBaseline[]Ordered plans; only the first five entries are considered for display. |
TypeScript declaration
export declare interface GanttTask {
id: Id;
name: string;
startDate: Date;
endDate?: Date;
duration?: number;
progress?: number;
type?: GanttTaskType;
parentId?: Id | null;
/** Ordered plans; only the first five entries are considered for display. */
baselines?: GanttBaseline[];
}Supporting types
These types appear in this signature but are not separate package exports.
declare type GanttTaskType = "task" | "milestone" | "summary";Id
Typeexport declare type Id = string | number;GanttBaseline
TypeConsumer-owned planned span. `endDate` is exclusive; milestones use only `startDate`.
| Property | Type & description |
|---|---|
idRequired | IdUnique within one task. |
titleOptional | string |
startDateRequired | Date |
endDateOptional | DateRequired for tasks and summaries, omitted for milestones. |
TypeScript declaration
/** Consumer-owned planned span. `endDate` is exclusive; milestones use only `startDate`. */
export declare interface GanttBaseline {
/** Unique within one task. */
id: Id;
title?: string;
startDate: Date;
/** Required for tasks and summaries, omitted for milestones. */
endDate?: Date;
}TaskDependency
Type| Property | Type & description |
|---|---|
fromRequired | Id |
toRequired | Id |
typeRequired | TaskDependencyType |
lagOptional | number |
TypeScript declaration
export declare type TaskDependency = {
from: Id;
to: Id;
type: TaskDependencyType;
lag?: number;
};export declare type TaskDependencyType = "FS" | "FF" | "SS" | "SF";Related examples
Hierarchy & bar typesParent/child nesting with summary, milestone, and task bars.DependenciesAll four link types, lag, and the cascading reschedule that follows a move.Critical pathHighlight the chain of tasks and links currently pinning the chart's end date.BaselinesCompare up to five consumer-supplied plans with each task's current dates.