Timeline scales
Day, week, month, and year views with matching drag intervals.
npm install @jaeungkim/gantt-chartDay, week, month, and year views with matching drag intervals.
Keeps large task sets responsive by rendering only what is visible.
Supports FS, SS, FF, and SF relationships with auto-routed connectors.
Drag bars, resize edges, and push updates back through a single callback.
Fits light, dark, and system themes without extra wrapper code.
The exported component stays small enough to drop into product code quickly.
import { ReactGanttChart } from "@jaeungkim/gantt-chart";import type { Task } from "@jaeungkim/gantt-chart";
const tasks: Task[] = [ { id: "1", name: "Project Kickoff", startDate: "2024-06-01T09:00:00Z", endDate: "2024-06-03T17:00:00Z", parentId: null, sequence: "1", dependencies: [], }, { id: "2", name: "Requirements Gathering", startDate: "2024-06-04T09:00:00Z", endDate: "2024-06-10T17:00:00Z", parentId: null, sequence: "2", dependencies: [{ targetId: "1", type: "FS" }], },];
export default function App() { return ( <ReactGanttChart tasks={tasks} height={600} width="100%" theme="system" defaultScale="month" onTasksChange={(updatedTasks) => console.log(updatedTasks)} /> );}All dates should be passed as UTC ISO strings such as 2024-06-01T09:00:00Z.
interface Task { id: string; name: string; startDate: string; // UTC ISO string endDate: string; // UTC ISO string parentId: string | null; sequence: string; dependencies?: TaskDependency[];}
interface TaskDependency { targetId: string; type: DependencyType;}
type DependencyType = "FS" | "SS" | "FF" | "SF";// FS = Finish-to-Start// SS = Start-to-Start// FF = Finish-to-Finish// SF = Start-to-FinishDrag bars, resize edges, and switch scales to test the interaction model.
| Prop | Type | Default | Description |
|---|---|---|---|
| tasks | Task[] | [] | Array of task objects to render. |
| onTasksChange | (tasks) => void | undefined | Receives updated task data after edits. |
| height | number | string | 600 | Chart height in pixels or any CSS length. |
| width | number | string | "100%" | Chart width in pixels or any CSS length. |
| theme | "light" | "dark" | "system" | "system" | Theme mode applied inside the chart. |
| defaultScale | "day" | "week" | "month" | "year" | "month" | Initial visible timeline scale. |
| className | string | undefined | Additional class name for the outer wrapper. |
The scale switcher in the chart header controls the visible timeline density.
| Scale | Header Label | Tick Unit | Drag Step |
|---|---|---|---|
| day | Day | Hour | 1 hour |
| week | Week | Day | 6 hours |
| month | Month | Day | 1 day |
| year | Year | Month | 7 days |
Questions or feedback? Open an issue and I’ll take a look.
Open an issue