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

Fields

string | number
Unique identifier for the task. Auto-generated if not provided when adding a task via api.exec("add-task", ...).
Date
The start date of the task. Provide a JavaScript Date object. Required unless the task is unscheduled.
Date
The end date of the task. If omitted, it is calculated from start and 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.
string
The display label rendered on the task bar and in the grid Name column.
string
Additional descriptive text shown in the task editor. Not rendered on the chart directly.
number
Task completion percentage, from 0 to 100. Rendered as a filled portion of the task bar.
'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.
string | number
ID of the parent task. Set to 0 or omit for root-level tasks. Used to build the task hierarchy.
boolean
default:"false"
Whether the task’s subtree is expanded. Only relevant for tasks with children (type: "summary").
ITask[]
Inline array of child task objects. An alternative to using parent references. When present, the task is treated as a summary.
Date
Baseline start date used when the baselines PRO feature is enabled. Renders a secondary bar showing the original planned schedule.
Date
Baseline end date. Used alongside base_start when the baselines feature is enabled.
number
Baseline duration. Calculated automatically if base_start and base_end are provided.
boolean
When true, this task is displayed as a rollup bar inside its parent summary task. Requires the rollups config option to be enabled.
boolean
When true, the task has no scheduled dates and is shown in the unscheduled tasks area. Requires the unscheduledTasks PRO config option.
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

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.