Prerequisites
- React >=18 and react-dom >=18
- A bundler that supports ES modules (Vite, webpack 5+, Next.js 13+)
Steps
Import the CSS
Import styles once at the top of your app entry point or in your root layout.
index.js
Render a basic chart
Import The chart renders immediately with drag-and-drop and inline editing enabled by default.
Gantt and pass an array of tasks. Each task requires at minimum an id, text, type, and either a start+duration or a start+end pair.GanttChart.jsx
Add task links (dependencies)
Pass a The
links array to connect tasks. Each link requires an id, a source task id, a target task id, and a type.GanttChart.jsx
e2s link type means end-to-start (finish-to-start dependency).Access the API via the init prop
Use the
init prop to receive the Gantt API instance. This unlocks programmatic control: adding tasks, updating data, handling events, and integrating companion components like Toolbar and Editor.GanttWithToolbar.jsx
init is called once with the IApi instance after the component mounts. Store it in state with useState so companion components like Toolbar and Editor re-render once the API is available.Task data reference
The table below summarises the fields you can set on each task object.| Field | Type | Description |
|---|---|---|
id | number | Unique task identifier. |
text | string | Display label shown in the grid and on the task bar. |
start | Date | Start date/time of the task. |
end | Date | End date/time. Use instead of duration, or omit when duration is set. |
duration | number | Duration in days (or hours when using an hour-scale). Mutually exclusive with end. |
progress | number | Completion percentage, 0–100. |
type | string | Task type: 'task', 'summary', or 'milestone'. |
parent | number | ID of the parent task. Use 0 for top-level tasks. |
open | boolean | Whether a summary task is expanded on first render. |
lazy | boolean | If true, children are loaded on demand. |
Next steps
Installation
Full installation details, CSS options, TypeScript setup, and framework-specific notes.
Configuration
Customise columns, scales, task types, themes, and more.
API reference
Explore every prop, event, and method exposed by the Gantt API.
Live demos
Browse interactive examples including drag-and-drop, custom templates, and 10k-task performance tests.