Gantt Chart
A full-featured project timeline component with drag & drop, hierarchical tasks, dependencies, multiple view modes, and rich customization.
Basic Usage
A minimal Gantt chart with default columns. Tasks auto-scroll to today on mount.
Basic Gantt Chart
import { GanttChart } from 'fluxo-ui';
import type { GanttTask } from 'fluxo-ui';
const tasks: GanttTask[] = [
{
id: '1',
name: 'Requirements Gathering',
start: new Date('2025-01-01'),
end: new Date('2025-01-07'),
progress: 100,
assignee: 'Alice',
},
{
id: '2',
name: 'UI Design',
start: new Date('2025-01-06'),
end: new Date('2025-01-14'),
progress: 60,
color: '#8b5cf6',
assignee: 'Bob',
},
// ...
];
function MyPage() {
return <GanttChart tasks={tasks} height={400} />;
}View Modes
Switch between Day, Week, Month, Quarter, and Year views. Can be controlled externally or left to the built-in toolbar.
Controlled View Mode
const [viewMode, setViewMode] = useState<GanttViewMode>('day');
<GanttChart
tasks={tasks}
height={400}
viewMode={viewMode}
onViewModeChange={setViewMode}
/>Hierarchical Tasks & Milestones
Nest child tasks inside a parent using the children array. Use type: 'group' for summary bars and type: 'milestone' for diamond markers. Groups can be collapsed.
Phases, Groups & Milestones
const tasks: GanttTask[] = [
{
id: 'phase-1',
name: 'Phase 1 — Discovery',
type: 'group',
start: new Date('2025-01-01'),
end: new Date('2025-01-14'),
progress: 90,
children: [
{ id: 'p1-t1', name: 'Stakeholder Interviews', start: '2025-01-01', end: '2025-01-05', progress: 100 },
{ id: 'p1-t2', name: 'Market Research', start: '2025-01-03', end: '2025-01-10', progress: 80 },
],
},
{
id: 'milestone-1',
name: 'Design Review',
type: 'milestone',
start: new Date('2025-01-14'),
end: new Date('2025-01-14'),
color: '#f59e0b',
},
];
<GanttChart tasks={tasks} height={400} />Task Dependencies
Connect tasks with dependency arrows using four relationship types: Finish-to-Start, Start-to-Start, Finish-to-Finish, and Start-to-Finish.
Dependency Arrows
const tasks: GanttTask[] = [
{
id: 'analysis',
name: 'Analysis',
start: '2025-01-01',
end: '2025-01-07',
progress: 100,
},
{
id: 'design',
name: 'Design',
start: '2025-01-08',
end: '2025-01-14',
progress: 60,
dependencies: [{ targetId: 'analysis', type: 'finish-to-start' }],
},
{
id: 'dev',
name: 'Development',
start: '2025-01-15',
end: '2025-01-28',
progress: 0,
dependencies: [{ targetId: 'design', type: 'finish-to-start' }],
},
];
// Supported dependency types:
// 'finish-to-start' | 'start-to-start' | 'finish-to-finish' | 'start-to-finish'Date Markers
Mark important dates (deadlines, releases) with labelled vertical lines and shade date ranges such as sprints with bands. Labels sit in a header row and are stacked when they collide. Overlapping bands get their own row, a band shows its shortLabel when the label does not fit, and the timeline widens to fill the panel (fillWidth).
Markers & Deadlines
import type { GanttBand, GanttMarker } from 'fluxo-ui';
const markers: GanttMarker[] = [
{ id: 'today', date: new Date(), label: 'Today', color: '#3b82f6' },
{ id: 'sprint', date: new Date('2025-02-07'), label: 'Sprint End', color: '#f59e0b' },
{ id: 'release', date: new Date('2025-02-28'), label: 'Release', color: '#10b981' },
];
const bands: GanttBand[] = [
{ id: 's12', start: '2025-01-27', end: '2025-02-07', label: 'Sprint 12', shortLabel: '12' },
{ id: 's13', start: '2025-02-10', end: '2025-02-21', label: 'Sprint 13', shortLabel: '13' },
];
<GanttChart tasks={tasks} markers={markers} bands={bands} height={400} />Drag & Drop / Resize
Drag task bars to move them or drag either handle to resize. Changes are reported via onTaskChange.
Interactive — Drag to Move, Handles to Resize
const [tasks, setTasks] = useState<GanttTask[]>(initialTasks);
const handleTaskChange = (e: GanttTaskChangeEvent) => {
setTasks(prev =>
prev.map(t => t.id === e.task.id
? { ...t, start: e.start, end: e.end }
: t
)
);
};
<GanttChart
tasks={tasks}
height={400}
allowTaskDrag={true} // default
allowTaskResize={true} // default
onTaskChange={handleTaskChange}
onTaskClick={({ task }) => console.log('clicked', task.name)}
onTaskDoubleClick={({ task }) => openEditModal(task)}
/>Creating Tasks by Drawing
Enable allowTaskCreate and let users draw new tasks by clicking and dragging on empty row space.
Draw New Tasks (drag on empty area)
const [tasks, setTasks] = useState<GanttTask[]>(initialTasks);
const handleTaskCreate = (e: GanttTaskCreateEvent) => {
const newTask: GanttTask = {
id: `task-${Date.now()}`,
name: 'New Task',
start: e.start,
end: e.end,
progress: 0,
};
setTasks(prev => [...prev, newTask]);
};
<GanttChart
tasks={tasks}
height={400}
allowTaskCreate={true}
onTaskCreate={handleTaskCreate}
/>Custom Columns
Define any number of columns with custom render templates. Access the full task object inside templates.
Custom Column Rendering
import type { GanttColumn } from 'fluxo-ui';
const columns: GanttColumn[] = [
{ field: 'name', headerText: 'Task', width: 200 },
{
field: 'assignee',
headerText: 'Owner',
width: 90,
align: 'center',
template: ({ value }) => (
<span style={{
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
width: 26, height: 26, borderRadius: '50%',
background: '#dbeafe', color: '#1d4ed8', fontWeight: 600, fontSize: 11,
}}>
{String(value ?? '?').charAt(0)}
</span>
),
},
{
field: 'progress',
headerText: '%',
width: 55,
align: 'center',
template: ({ value }) => (
<span style={{ color: value === 100 ? '#10b981' : '#6b7280', fontWeight: 600 }}>
{value}%
</span>
),
},
];
<GanttChart tasks={tasks} columns={columns} fieldsPanelWidth={360} height={400} />Sprint / Resource Planning
Use extra data fields with column templates to show metadata like priority or task type alongside the timeline.
Sprint Backlog View
const tasks: GanttTask[] = [
{
id: 'feature-auth',
name: 'Feature: Auth',
start: '2025-01-06',
end: '2025-01-14',
progress: 75,
assignee: 'Alice',
data: { priority: 'High', type: 'Dev' },
},
// ...
];
const columns: GanttColumn[] = [
{ field: 'name', headerText: 'Task', width: 180 },
{ field: 'assignee', headerText: 'Assignee', width: 80, align: 'center' },
{
field: 'data.priority',
headerText: 'Priority',
width: 75,
align: 'center',
template: ({ task }) => {
const priority = (task.data as any)?.priority;
const colors = { Critical: '#ef4444', High: '#f59e0b', Medium: '#3b82f6' };
return (
<span style={{
padding: '1px 6px', borderRadius: 10, fontSize: 10, fontWeight: 600,
background: `${colors[priority]}20`, color: colors[priority],
}}>
{priority}
</span>
);
},
},
];
// Mark weekends as holidays
const isHoliday = (date: Date) => date.getDay() === 0 || date.getDay() === 6;
<GanttChart
tasks={tasks}
columns={columns}
fieldsPanelWidth={360}
isHoliday={isHoliday}
markers={[
{ date: sprintStart, label: 'Sprint Start', color: '#3b82f6' },
{ date: sprintEnd, label: 'Sprint End', color: '#f59e0b' },
]}
height={420}
/>Quarterly / Annual View
Use viewMode="quarter" or "year" for roadmap-level planning across many months.
Quarterly Roadmap
<GanttChart
tasks={roadmapTasks}
viewMode="month" // or "quarter" | "year" for wider ranges
height={400}
columns={[{ field: 'name', headerText: 'Initiative', width: 200 }]}
/>Read-Only Mode
Set readOnly to disable all interactions. Useful for dashboards and reports.
Read-Only Gantt
<GanttChart
tasks={tasks}
height={400}
readOnly={true}
/>Timeline-Only View
Hide the left fields panel entirely with showFieldsPanel={false} for a compact timeline.
No Fields Panel
<GanttChart
tasks={tasks}
height={300}
showFieldsPanel={false}
/>Import
import { GanttChart } from 'fluxo-ui';
// Type imports
import type {
GanttTask,
GanttColumn,
GanttMarker,
GanttDependency,
GanttViewMode,
GanttTaskChangeEvent,
GanttTaskClickEvent,
GanttTaskCreateEvent,
GanttColumnTemplateProps,
TaskBarTemplateProps,
} from 'fluxo-ui';GanttChart Props
tasksreqGanttTask[]Array of task objects to display on the chart
tasksreqGanttTask[]Array of task objects to display on the chart
columnsGanttColumn[]"[{ field: 'name', headerText: 'Task Name', width: 200 }]"Column definitions for the left fields panel
columnsGanttColumn[]"[{ field: 'name', headerText: 'Task Name', width: 200 }]"Column definitions for the left fields panel
viewMode'day' | 'week' | 'month' | 'quarter' | 'year'"'day'"Controls how the timeline is rendered and grouped
viewMode'day' | 'week' | 'month' | 'quarter' | 'year'"'day'"Controls how the timeline is rendered and grouped
startDateDate | stringOverride the auto-computed start date of the visible range
startDateDate | stringOverride the auto-computed start date of the visible range
endDateDate | stringOverride the auto-computed end date of the visible range
endDateDate | stringOverride the auto-computed end date of the visible range
heightnumber | string"500"Total height of the Gantt chart container
heightnumber | string"500"Total height of the Gantt chart container
rowHeightnumber"40"Height of each task row in pixels
rowHeightnumber"40"Height of each task row in pixels
columnWidthnumberWidth of each timeline column. Defaults vary by view mode. With fillWidth it is the minimum width
columnWidthnumberWidth of each timeline column. Defaults vary by view mode. With fillWidth it is the minimum width
fillWidthboolean"true"Widens the columns so the timeline fills the available width when it is narrower than the panel
fillWidthboolean"true"Widens the columns so the timeline fills the available width when it is narrower than the panel
fieldsPanelWidthnumber | string"300"Width of the left-side fields/columns panel
fieldsPanelWidthnumber | string"300"Width of the left-side fields/columns panel
showFieldsPanelboolean"true"Toggle the left fields panel visibility
showFieldsPanelboolean"true"Toggle the left fields panel visibility
showTodayboolean"true"Highlight today with a vertical line and scroll to it on mount
showTodayboolean"true"Highlight today with a vertical line and scroll to it on mount
showDependenciesboolean"true"Render SVG dependency arrows between tasks
showDependenciesboolean"true"Render SVG dependency arrows between tasks
showProgressboolean"true"Render the progress overlay on task bars
showProgressboolean"true"Render the progress overlay on task bars
showTooltipboolean"true"Show hover tooltip with task details
showTooltipboolean"true"Show hover tooltip with task details
markersGanttMarker[]"[]"Vertical date markers (deadlines, milestones, events). Labels are shown in a header row and stacked when they collide; labels that do not fit show as a tick with a tooltip
markersGanttMarker[]"[]"Vertical date markers (deadlines, milestones, events). Labels are shown in a header row and stacked when they collide; labels that do not fit show as a tick with a tooltip
bandsGanttBand[]"[]"Shaded date ranges behind the task bars (sprints, release windows, freeze periods) with an optional label in the header. Overlapping bands get their own header row, and shortLabel is shown when the label does not fit
bandsGanttBand[]"[]"Shaded date ranges behind the task bars (sprints, release windows, freeze periods) with an optional label in the header. Overlapping bands get their own header row, and shortLabel is shown when the label does not fit
isHoliday(date: Date) => booleanCallback to determine if a date should be marked as a holiday
isHoliday(date: Date) => booleanCallback to determine if a date should be marked as a holiday
allowTaskDragboolean"true"Allow users to drag tasks to new dates
allowTaskDragboolean"true"Allow users to drag tasks to new dates
allowTaskResizeboolean"true"Allow users to resize task bars from either end
allowTaskResizeboolean"true"Allow users to resize task bars from either end
allowTaskCreateboolean"false"Allow users to drag on empty rows to create new tasks
allowTaskCreateboolean"false"Allow users to drag on empty rows to create new tasks
readOnlyboolean"false"Disable all drag, resize, and create interactions
readOnlyboolean"false"Disable all drag, resize, and create interactions
taskBarTemplate(props: TaskBarTemplateProps) => ReactNodeCustom render function for task bar content
taskBarTemplate(props: TaskBarTemplateProps) => ReactNodeCustom render function for task bar content
tooltipTemplate(task: GanttTask) => ReactNodeCustom render function for the hover tooltip
tooltipTemplate(task: GanttTask) => ReactNodeCustom render function for the hover tooltip
onTaskChange(event: GanttTaskChangeEvent) => voidFires when a task is moved or resized
onTaskChange(event: GanttTaskChangeEvent) => voidFires when a task is moved or resized
onTaskClick(event: GanttTaskClickEvent) => voidFires when a task bar is clicked
onTaskClick(event: GanttTaskClickEvent) => voidFires when a task bar is clicked
onTaskDoubleClick(event: GanttTaskClickEvent) => voidFires when a task bar is double-clicked
onTaskDoubleClick(event: GanttTaskClickEvent) => voidFires when a task bar is double-clicked
onTaskCreate(event: GanttTaskCreateEvent) => voidFires when a new task range is drawn (requires allowTaskCreate)
onTaskCreate(event: GanttTaskCreateEvent) => voidFires when a new task range is drawn (requires allowTaskCreate)
onViewModeChange(mode: GanttViewMode) => voidFires when the user switches the view mode
onViewModeChange(mode: GanttViewMode) => voidFires when the user switches the view mode
onExpandToggle(task: GanttTask, expanded: boolean) => voidFires when a group task is expanded or collapsed
onExpandToggle(task: GanttTask, expanded: boolean) => voidFires when a group task is expanded or collapsed
allowDependencyCreateboolean"false"Shows a connector on each bar that can be dragged onto another bar to create a dependency (requires onDependencyCreate)
allowDependencyCreateboolean"false"Shows a connector on each bar that can be dragged onto another bar to create a dependency (requires onDependencyCreate)
onSegmentChange(event: GanttSegmentChangeEvent) => voidCalled after a segment of a task is moved or resized
onSegmentChange(event: GanttSegmentChangeEvent) => voidCalled after a segment of a task is moved or resized
onSegmentClick(event: GanttSegmentClickEvent) => voidCalled when a segment of a task is clicked
onSegmentClick(event: GanttSegmentClickEvent) => voidCalled when a segment of a task is clicked
onSegmentDoubleClick(event: GanttSegmentClickEvent) => voidCalled when a segment of a task is double-clicked
onSegmentDoubleClick(event: GanttSegmentClickEvent) => voidCalled when a segment of a task is double-clicked
onDependencyCreate(event: GanttDependencyCreateEvent) => voidCalled when a dependency is drawn from one bar (fromTask) to another (toTask)
onDependencyCreate(event: GanttDependencyCreateEvent) => voidCalled when a dependency is drawn from one bar (fromTask) to another (toTask)
onDependencyClick(event: GanttDependencyClickEvent) => voidMakes dependency lines clickable, for example to remove a dependency
onDependencyClick(event: GanttDependencyClickEvent) => voidMakes dependency lines clickable, for example to remove a dependency
GanttTask Properties
idreqstringUnique identifier for the task
idreqstringUnique identifier for the task
namereqstringDisplay name of the task
namereqstringDisplay name of the task
startreqDate | stringStart date of the task
startreqDate | stringStart date of the task
endreqDate | stringEnd date of the task
endreqDate | stringEnd date of the task
progressnumber"0"Completion percentage (0-100)
progressnumber"0"Completion percentage (0-100)
type'task' | 'milestone' | 'group'"'task'"Determines visual style and behavior
type'task' | 'milestone' | 'group'"'task'"Determines visual style and behavior
colorstringCustom background color for the task bar
colorstringCustom background color for the task bar
textColorstringCustom text color inside the task bar
textColorstringCustom text color inside the task bar
dependenciesGanttDependency[]Array of dependency connections to other tasks
dependenciesGanttDependency[]Array of dependency connections to other tasks
childrenGanttTask[]Nested child tasks (makes this task a group/parent)
childrenGanttTask[]Nested child tasks (makes this task a group/parent)
collapsedboolean"false"Whether this group is initially collapsed
collapsedboolean"false"Whether this group is initially collapsed
assigneestringAssignee name shown in tooltip and custom columns
assigneestringAssignee name shown in tooltip and custom columns
draggableboolean"true"Override draggability for this specific task
draggableboolean"true"Override draggability for this specific task
resizableboolean"true"Override resizability for this specific task
resizableboolean"true"Override resizability for this specific task
tooltipReactNode | ((task: GanttTask) => ReactNode)Custom tooltip content for this task
tooltipReactNode | ((task: GanttTask) => ReactNode)Custom tooltip content for this task
dataRecord<string, unknown>Arbitrary extra data accessible in templates
dataRecord<string, unknown>Arbitrary extra data accessible in templates
segmentsGanttSegment[]Several bars on the same row (for example work split into phases). The task start and end still define its overall span
segmentsGanttSegment[]Several bars on the same row (for example work split into phases). The task start and end still define its overall span
Features
View Modes
5 built-in scales: Day, Week, Month, Quarter, Year with smart header grouping
Drag & Drop
Move tasks and resize from both ends with live visual feedback
Task Creation
Draw new tasks by clicking and dragging on empty row space
Hierarchical Tasks
Unlimited nesting depth with expand/collapse support
Task Types
Regular tasks, group/summary bars with caps, and diamond milestones
Dependencies
4 dependency types (FS, SS, FF, SF) rendered as curved SVG arrows
Progress Bars
Visual completion overlay on each task bar
Date Markers
Labelled vertical lines for deadlines, sprints, and events
Custom Columns
Any field from task data with full JSX template support
Custom Tooltips
Per-task or global tooltip template override
Holiday Support
isHoliday callback colors non-working days differently
Scroll Sync
Left and right panels stay vertically synchronized
Theming
Full dark/light + 5 brand themes via CSS variables — zero extra config
Responsive
Fields panel auto-hides on mobile, toolbar wraps on small screens
Accessibility
ARIA labels, keyboard focus, semantic roles on all interactive elements
Performance
React.memo, useMemo, useCallback throughout — handles large datasets