Why React Teams Choose ApexGantt

The react-apexgantt wrapper exposes the chart as a real React component, <ApexGanttChart />, with props, events, refs, and hooks that match how React applications already work, not a thin shell around an imperative library that leaves you fighting refs and effect cleanup. It shares its core engine with ApexGantt's Angular, Vue, and JavaScript wrappers, so the task data and configuration API stay consistent if your stack grows beyond React. Learn about the full ApexGantt component →

Drag-and-Drop Scheduling, Driven by React State

Drag tasks to reschedule, resize bars to change durations, and draw dependency arrows, all on the timeline. Each interaction fires a typed callback (onTaskDragged, onTaskResized, onTaskUpdateSuccess) so you can persist the change to your backend or store, then pass the updated tasks back as a prop. Watch the scripted plan move, then grab a bar yourself.


Critical Path That Recomputes on Every Edit

ApexGantt highlights the longest chain of dependent tasks that drives your finish date. Update a task through props or the ref API and the critical path recomputes automatically, so a slip becomes visible the moment your React state changes. Watch it re-route between the two branches below.


Baselines for Planned vs. Actual

Attach a planned (baseline) range to each task in the same tasks array and ApexGantt draws a thin reference bar beneath the live one, so schedule variance is visible at a glance. No separate data structure, just an extra field on the task you already pass as a prop. The demo drifts the actuals past plan to show a slipping project.


Multiple View Modes via a Single Prop

Switch between day, week, month, quarter, and year scales by changing the viewMode prop, with no data re-query. This one auto-zooms; interact to take the controls.

Task Dependencies

Finish-to-start, start-to-start, and finish-to-finish links with lag, set on the tasks you pass as a prop.

Milestones

Zero-duration diamond markers for gates, releases, and key dates.

Annotations

Pin sprint boundaries, deadlines, or notes to specific dates through the options prop.

Resizable Sidebar

A resizable task list that adapts to long task names or more timeline room.

Rich HTML Tooltips

Templatable tooltips showing dates, duration, progress, and dependencies.

Custom Colors & Dark Theme

Flip themes with the theme prop; deeper styling via the options object.

SVG Export

Export timelines to high-quality SVG with every task and dependency preserved.

TypeScript Types

Definitions ship for the ApexGanttChart props, TaskInput, GanttUserOptions, and the ref handle.

Install in Your React App

ApexGantt for React requires two packages: the React wrapper and the core engine. Install both:

npm install react-apexgantt apexgantt
# or
pnpm add react-apexgantt apexgantt
# or
yarn add react-apexgantt apexgantt

Import the component and pass a tasks array:

import React from "react"
import { ApexGanttChart } from "react-apexgantt"

export default function ProjectTimeline() {
  const tasks = [
    { id: "task-1", name: "Design",      startTime: "01-01-2026", endTime: "01-15-2026", progress: 75 },
    { id: "task-2", name: "Development", startTime: "01-16-2026", endTime: "02-28-2026", progress: 40, dependency: "task-1" },
    { id: "task-3", name: "QA",          startTime: "03-01-2026", endTime: "03-15-2026", progress: 0,  dependency: "task-2" }
  ]

  return <ApexGanttChart tasks={tasks} viewMode="week" height="500px" />
}

That's a complete, working React Gantt chart. Dependencies render as arrows between tasks. The viewMode prop accepts "day", "week", "month", "quarter", or "year".

Working with React State and Events

ApexGantt's event callbacks keep your React state in sync with whatever the user does on the timeline. Drag a task and onTaskDragged fires; resize one and onTaskResized fires; finish an edit and onTaskUpdateSuccess fires with the resolved task.

import { useRef } from "react"
import { ApexGanttChart, type ApexGanttHandle } from "react-apexgantt"

export default function ScheduleEditor({ initialTasks }) {
  const ganttRef = useRef<ApexGanttHandle>(null)

  const handleTaskUpdateSuccess = async (detail) => {
    // persist to your backend
    await fetch(`/api/tasks/${detail.taskId}`, {
      method: "PATCH",
      body: JSON.stringify(detail.updatedTask)
    })
  }

  return (
    <ApexGanttChart
      ref={ganttRef}
      tasks={initialTasks}
      viewMode="week"
      height="600px"
      onTaskDragged={(d) => console.log("dragged", d)}
      onTaskResized={(d) => console.log("resized", d)}
      onTaskUpdateSuccess={handleTaskUpdateSuccess}
    />
  )
}

The wrapper exposes eight callbacks (onTaskUpdate, onTaskUpdateSuccess, onTaskUpdateError, onTaskValidationError, onTaskDragged, onTaskResized, onSelectionChange, onDependencyArrowUpdate) and an imperative ref handle with update, updateTask, zoomIn, zoomOut, destroy, and getInstance. The pattern works the same with Redux Toolkit, Zustand, Jotai, or React Query.

Mapping Your API Shape with useGanttData

API responses rarely match the exact field names ApexGantt expects. The useGanttData hook converts your shape into ApexGantt's task model without hand-written transformation code:

import { useGanttData, ApexGanttChart } from "react-apexgantt"

function ProjectTimeline({ apiData }) {
  const tasks = useGanttData({
    data: apiData,
    parsing: {
      id: "task_id",
      name: "task_name",
      startTime: "start_date",
      endTime: "end_date"
    }
  })

  return <ApexGanttChart tasks={tasks} viewMode="week" />
}

TypeScript Support in React

ApexGantt ships TypeScript definitions for the React component, the task data model, configuration options, and the ref handle. No @types/ package needed.

import {
  ApexGanttChart,
  type TaskInput,
  type GanttUserOptions,
  type ViewMode,
  type ApexGanttHandle
} from "react-apexgantt"

const tasks: TaskInput[] = [
  { id: "task-1", name: "Design", startTime: "01-01-2026", endTime: "01-15-2026", progress: 0 }
]

const viewMode: ViewMode = "week"

react-apexgantt peer-depends on react >=16.8.0 and react-dom >=16.8.0, so the floor is React 16.8+ and the open range covers React 17, 18, and 19.

Commercial License Setup

If you have a commercial ApexGantt license, set it once at application start, before any chart renders:

// main.tsx or index.tsx
import React from "react"
import ReactDOM from "react-dom/client"
import { setApexGanttLicense } from "react-apexgantt"
import App from "./App"

setApexGanttLicense("your-license-key-here")

ReactDOM.createRoot(document.getElementById("root")!).render(<App />)

The community edition runs without a license key.

Performance with Large React Gantt Timelines

ApexGantt renders large project timelines quickly. On an Apple M4 Pro (apexgantt 3.11.1, headless Chromium):

~65 ms1,000 tasks
~275 ms5,000 tasks
~620 ms10,000 tasks

React Gantt Chart FAQ

How do I install ApexGantt for React?

Run npm install react-apexgantt apexgantt. Both packages are required: react-apexgantt is the React wrapper, and apexgantt is the core engine it depends on. Import ApexGanttChart from react-apexgantt and render it with a tasks array.

Does ApexGantt support TypeScript?

Yes. Type definitions ship with the package, covering the ApexGanttChart component props, the TaskInput data model, GanttUserOptions configuration, the ViewMode union, and the ApexGanttHandle ref interface. No separate @types/ install is required.

How do I handle task drag-and-drop in React state?

Wire the onTaskDragged, onTaskResized, and onTaskUpdateSuccess callbacks to persist updates to your backend or update your local store. The chart fires each event with a detail object containing the updated task; pass the new task array back as a prop and the chart reflects the change.

Does ApexGantt support critical path and baselines?

Yes. Critical path highlighting and baseline (planned-vs-actual) tracking are both built in. They use the same task data model and ship with worked demos.

How do I set the ApexGantt commercial license in a React app?

Import setApexGanttLicense from react-apexgantt and call it once at application start, typically in main.tsx or index.tsx, before rendering any chart. The community edition runs without a license key.

Can ApexGantt handle large React Gantt timelines?

Yes. In a benchmark on an Apple M4 Pro, ApexGantt rendered a 5,000-task timeline in about 275 ms and a 10,000-task timeline in about 620 ms (apexgantt 3.11.1).

Ready to build your React project timeline?

The fastest path is the demos: running examples you can read and copy from.

See ApexGantt Demos
React Gantt Chart Component | ApexGantt