Skip to main content
The ITask interface defines the shape of a task object in SVAR Svelte Gantt. Tasks are the primary data unit rendered as bars on the Gantt chart.

TypeScript definition

export interface ITask {
  id?: TID;
  start?: Date;
  end?: Date;
  duration?: number;
  text?: string;
  details?: string;
  progress?: number;
  type?: TTaskType;
  parent?: TID;
  open?: boolean;
  data?: ITask[];
  base_start?: Date;
  base_end?: Date;
  base_duration?: number;
  rollup?: boolean;
  unscheduled?: boolean;
  segments?: Partial<ITask>[];
  [key: string]: any;
}

export type TTaskType = "task" | "summary" | "milestone" | string;
export type TID = string | number;

Fields

id
string | number
Unique identifier for the task. Auto-generated if not provided when adding a task via api.exec("add-task", ...).
start
Date
The start date of the task. Provide a JavaScript Date object. Required unless the task is unscheduled.
end
Date
The end date of the task. If omitted, it is calculated from start and duration.
duration
number
The task duration in durationUnit units (days by default). If both end and duration are provided, end takes precedence and duration is recalculated.
text
string
The display label rendered on the task bar and in the grid Name column.
details
string
Additional descriptive text shown in the task editor. Not rendered on the chart directly.
progress
number
Task completion percentage, from 0 to 100. Rendered as a filled portion of the task bar.
type
'task' | 'summary' | 'milestone' | string
default:"task"
The task type. Built-in values:
  • "task" — regular task bar
  • "summary" — parent group bar that spans its children
  • "milestone" — zero-duration diamond marker
You can register custom types via the taskTypes config prop.
parent
string | number
ID of the parent task. Set to 0 or omit for root-level tasks. Used to build the task hierarchy.
open
boolean
default:"false"
Whether the task’s subtree is expanded. Only relevant for tasks with children (type: "summary").
data
ITask[]
Inline array of child task objects. An alternative to using parent references. When present, the task is treated as a summary.
base_start
Date
Baseline start date used when the baselines PRO feature is enabled. Renders a secondary bar showing the original planned schedule.
base_end
Date
Baseline end date. Used alongside base_start when the baselines feature is enabled.
base_duration
number
Baseline duration. Calculated automatically if base_start and base_end are provided.
rollup
boolean
When true, this task is displayed as a rollup bar inside its parent summary task. Requires the rollups config option to be enabled.
unscheduled
boolean
When true, the task has no scheduled dates and is shown in the unscheduled tasks area. Requires the unscheduledTasks PRO config option.
segments
Partial<ITask>[]
Array of sub-task segments for split tasks. Each segment is a partial ITask with start, end, and duration. Requires the splitTasks PRO config option.

Example task objects

const task: ITask = {
  id: 1,
  text: "Design phase",
  start: new Date("2024-03-01"),
  end: new Date("2024-03-15"),
  progress: 60,
  type: "task",
  parent: 0
};
You can attach arbitrary custom fields to any task object (the interface includes [key: string]: any). Custom fields are accessible in column templates and the task editor.

Build docs developers (and LLMs) love