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