<Gantt> component renders the full Gantt chart — timeline, grid, task bars, and dependency links. All other SVAR components (Toolbar, Editor, ContextMenu, Tooltip) connect to it through the IApi instance exposed via the init prop or a ref.
Import
Basic usage
Props
Data
Array of task objects to render. Each task requires at minimum an
id, type, and either start+duration or start+end.Array of dependency link objects connecting tasks.Link type values:
'e2s' (end-to-start), 's2s' (start-to-start), 'e2e' (end-to-end), 's2e' (start-to-end).Array of task IDs that are selected. Use for controlled selection.
ID of the task whose editor is currently open. Use for controlled editor state.
Timeline
Time scale rows displayed in the timeline header. Defaults to a two-row month/day scale.Default value:
Explicit start of the visible timeline range. When
null and autoScale is true, the range is derived from task dates.Explicit end of the visible timeline range. When
null and autoScale is true, the range is derived from task dates.The unit used to measure the timeline length — either
'day' or 'hour'.The unit used to interpret the
duration field on each task.Width in pixels of each timeline cell (one
lengthUnit).Height in pixels of each task row.
Height in pixels of each scale header row.
When
true, the timeline start and end dates are automatically derived from the task data if start and end are not provided.Enables mouse-wheel zoom on the timeline. Pass
true to use default zoom levels, or an IZoomConfig object to configure custom levels.Array of vertical marker objects drawn on the timeline. PRO feature.
Grid
Grid column definitions. Pass
false to hide the grid entirely. Defaults to the built-in defaultColumns (task name + add button).Task types
Definitions for the available task types (
task, summary, milestone). Defaults to defaultTaskTypes.Display
Controls the grid lines drawn in the timeline.
'column' draws only vertical column borders; 'full' draws both horizontal and vertical borders.taskTemplate
FC<{ data: ITask; api: IApi; onaction: (ev: { action: string; data: Record<string, any> }) => void }>
Custom React component rendered inside each task bar. Receives the task data, the
IApi instance, and an onaction callback for dispatching custom actions.Function called for each cell in the timeline. Return a CSS class string to apply custom background styling (for example to highlight weekends). When a
calendar prop is set, this is overridden by calendar-based highlighting.Editing
When
true, disables all user interaction — drag-and-drop, inline editing, and dependency drawing.Enables undo/redo history. PRO feature.
PRO features
Enables baseline bars drawn below each task bar, showing the originally planned dates. PRO feature.
When
true, tasks without a start date are shown as unscheduled in a dedicated row. PRO feature.Critical path configuration object. When set, tasks on the critical path are highlighted. PRO feature.
Auto-scheduling mode.
{ type: 'forward' } enables basic forward scheduling. { auto: true } enables full auto-scheduling where all task dates are recalculated from dependencies. PRO feature.Project start date used by the auto-scheduler. PRO feature.
Project end date used by the auto-scheduler. PRO feature.
Work calendar instance (created via the PRO calendar API) that defines working days and hours. When set, overrides
highlightTime. PRO feature.Enables split-task segments so a single task can have non-contiguous date ranges. PRO feature.
Summary task automation configuration. PRO feature.
Lifecycle
Callback invoked once after the component mounts with the
IApi instance. This is the primary way to access the API and wire up companion components.Event callbacks
Gantt actions are surfaced ason-prefixed callback props derived from the internal TMethodsConfig action map. Each callback receives the action payload as its argument.
Fires when a task is selected.
Fires when a task’s data is updated (move, resize, inline edit, or editor save).
onAddTask
(ev: { task: Partial<ITask>; target?: number | string; mode?: 'before' | 'after' | 'child' }) => void
Fires when a new task is added.
Fires when a task is deleted.
Fires when a task is moved in the tree order.
Fires when a task is copied.
Fires when a task is cut.
Fires when a task is pasted.
Fires when a task is indented (nested under the task above).
Fires when a task is unindented (moved up one level in the tree).
Fires when a dependency link is created.
Fires when a dependency link is deleted.
Fires when the task editor is opened or closed (
id is null on close).Fires when the timeline is scrolled.
Fires when an undo action is performed. PRO feature.
Fires when a redo action is performed. PRO feature.
Ref API
You can attach aref to <Gantt> to access the IApi object imperatively. The ref exposes the same object as the init callback.
IApi methods
Dispatches a named action to the Gantt store. Common actions:
'add-task', 'update-task', 'delete-task', 'select-task', 'show-editor', 'move-task', 'undo', 'redo'.Subscribes to a named action event. The handler is called after the action completes.
Subscribes to an action before it is processed. Return
false from the handler to cancel the action.Removes an event or intercept subscription.
Returns a snapshot of the current Gantt state (tasks, links, scales, etc.).
Returns the reactive (observable) state object.
Returns a single task by ID, or
null if not found.Returns a plain serialisable snapshot of all tasks and links.
Returns the current undo/redo history state. PRO feature.
Returns the internal grid table API. Pass
true to wait one tick for the DOM to finish rendering.Returns the internal data store(s) for low-level access.
Chains an additional event bus at the end of the action pipeline.
Usage with Toolbar and Editor
Handling events
api.on() inside the init callback: