Quick Start with React Gantt
This tutorial covers the React wrapper included in the Commercial, Enterprise, and Ultimate editions of DHTMLX Gantt. If you are using the Individual or GPL edition, follow the alternative guide: How to Start with React.
The React Gantt component is the official wrapper for DHTMLX Gantt. This guide walks you through creating a small React application and rendering a basic Gantt chart using the trial package.
If you're new to React, start with the official React documentation. Check a complete working project that follows this tutorial on GitHub.
Version requirements
- React 18 or newer
Creating a new React project
To create a React project and go to the project directory, run the following commands:
npm create vite@latest react-gantt-quick-start -- --template react-ts
cd react-gantt-quick-start
Installing React Gantt
Install React Gantt as described in the React Gantt installation guide.
In this tutorial we use the evaluation package:
npm install @dhtmlx/trial-react-gantt
or
yarn add @dhtmlx/trial-react-gantt
If you already use the Professional package, replace @dhtmlx/trial-react-gantt with @dhx/react-gantt in the commands and imports.
Adding demo data
We'll use static data for this example. Create a file named src/demoData.ts:
import type { Task, Link } from '@dhtmlx/trial-react-gantt';
export const tasks: Task[] = [
{ id: 1, text: "Office itinerancy", type: "project", start_date: new Date(2025, 3, 2), duration: 17, progress: 0.4, parent: 0, open: true },
...
];
export const links: Link[] = [
{ id: 2, source: 2, target: 3, type: "0" },
...
];