Fluxo UIFluxo UIv0.4.93

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

Task Name
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
June 2026
July 2026
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
Basic Example
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

Task Name
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
June 2026
July 2026
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
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

Task
Owner
Phase 1 — Discovery
Stakeholder Interviews
Alice
Market Research
Bob
Competitive Analysis
Carol
Phase 2 — Design
Wireframes
Dave
Visual Design
Eve
Prototyping
Alice
Phase 3 — Development
Design Review
Launch
June 2026
July 2026
August 2026
9Tue
10Wed
11Thu
12Fri
13Sat
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
26Sun
27Mon
28Tue
29Wed
30Thu
31Fri
1Sat
2Sun
3Mon
4Tue
5Wed
6Thu
7Fri
Phase 1 — Discovery
Stakeholder Interviews
Market Research
Competitive Analysis
Phase 2 — Design
Wireframes
Visual Design
Prototyping
Phase 3 — Development
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

Task
Analysis
Design
Development
Parallel Task A
Parallel Task B
Testing
June 2026
July 2026
11Thu
12Fri
13Sat
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Analysis
Design
Development
Parallel Task A
Parallel Task B
Testing
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 (sprint boundaries, deadlines, releases) with labelled vertical lines.

Markers & Deadlines

Task Name
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
June 2026
July 2026
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Today
Sprint End
Release
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
import type { 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' },
];

<GanttChart tasks={tasks} markers={markers} 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

Task Name
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
June 2026
July 2026
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
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)

Task Name
Existing Task
June 2026
July 2026
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
Existing Task
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

Task
Owner
%
Project Kickoff
A
100%
Requirements Gathering
B
80%
UI Design
C
40%
Backend Development
D
20%
Testing & QA
E
0%
Deployment
A
0%
June 2026
July 2026
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
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

Task
Assignee
Priority
Sprint Planning
Team
Feature: Auth
Alice
High
Feature: Dashboard
Bob
High
Bug Fixes
Carol
Critical
Code Review
Dave
Documentation
Eve
Sprint Review
Team
Sprint Retrospective
Team
June 2026
July 2026
12Fri
13Sat
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
Sprint Start
Sprint End
Sprint Planning
Feature: Auth
Feature: Dashboard
Bug Fixes
Code Review
Documentation
Sprint Review
Sprint Retrospective
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

Initiative
Q1 — Foundation
Infrastructure Setup
Core Platform
Q2 — Growth
Feature A
Feature B
Mobile App
Q3 — Scale
Performance
Enterprise
v1.0 Launch
v2.0 Launch
2026
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Q1 — Foundation
Infrastructure Setup
Core Platform
Q2 — Growth
Feature A
Feature B
Mobile App
Q3 — Scale
Performance
Enterprise
<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

Task Name
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
June 2026
July 2026
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Today
Sprint End
Release
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
<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

June 2026
July 2026
14Sun
15Mon
16Tue
17Wed
18Thu
19Fri
20Sat
21Sun
22Mon
23Tue
24Wed
25Thu
26Fri
27Sat
28Sun
29Mon
30Tue
1Wed
2Thu
3Fri
4Sat
5Sun
6Mon
7Tue
8Wed
9Thu
10Fri
11Sat
12Sun
13Mon
14Tue
15Wed
16Thu
17Fri
18Sat
19Sun
20Mon
21Tue
22Wed
23Thu
24Fri
25Sat
Today
Project Kickoff
Requirements Gathering
UI Design
Backend Development
Testing & QA
Deployment
<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

tasksreq
GanttTask[]

Array of task objects to display on the chart

columns
GanttColumn[]"[{ 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

startDate
Date | string

Override the auto-computed start date of the visible range

endDate
Date | string

Override the auto-computed end date of the visible range

height
number | string"500"

Total height of the Gantt chart container

rowHeight
number"40"

Height of each task row in pixels

columnWidth
number

Width of each timeline column. Defaults vary by view mode

fieldsPanelWidth
number | string"300"

Width of the left-side fields/columns panel

showFieldsPanel
boolean"true"

Toggle the left fields panel visibility

showToday
boolean"true"

Highlight today with a vertical line and scroll to it on mount

showDependencies
boolean"true"

Render SVG dependency arrows between tasks

showProgress
boolean"true"

Render the progress overlay on task bars

showTooltip
boolean"true"

Show hover tooltip with task details

markers
GanttMarker[]"[]"

Vertical date markers (deadlines, milestones, events)

isHoliday
(date: Date) => boolean

Callback to determine if a date should be marked as a holiday

allowTaskDrag
boolean"true"

Allow users to drag tasks to new dates

allowTaskResize
boolean"true"

Allow users to resize task bars from either end

allowTaskCreate
boolean"false"

Allow users to drag on empty rows to create new tasks

readOnly
boolean"false"

Disable all drag, resize, and create interactions

taskBarTemplate
(props: TaskBarTemplateProps) => JSX.Element

Custom render function for task bar content

tooltipTemplate
(task: GanttTask) => ReactNode

Custom render function for the hover tooltip

onTaskChange
(event: GanttTaskChangeEvent) => void

Fires when a task is moved or resized

onTaskClick
(event: GanttTaskClickEvent) => void

Fires when a task bar is clicked

onTaskDoubleClick
(event: GanttTaskClickEvent) => void

Fires when a task bar is double-clicked

onTaskCreate
(event: GanttTaskCreateEvent) => void

Fires when a new task range is drawn (requires allowTaskCreate)

onViewModeChange
(mode: GanttViewMode) => void

Fires when the user switches the view mode

onExpandToggle
(task: GanttTask, expanded: boolean) => void

Fires when a group task is expanded or collapsed

GanttTask Properties

idreq
string

Unique identifier for the task

namereq
string

Display name of the task

startreq
Date | string

Start date of the task

endreq
Date | string

End date of the task

progress
number"0"

Completion percentage (0-100)

type
'task' | 'milestone' | 'group'"'task'"

Determines visual style and behavior

color
string

Custom background color for the task bar

textColor
string

Custom text color inside the task bar

dependencies
GanttDependency[]

Array of dependency connections to other tasks

children
GanttTask[]

Nested child tasks (makes this task a group/parent)

collapsed
boolean"false"

Whether this group is initially collapsed

assignee
string

Assignee name shown in tooltip and custom columns

draggable
boolean"true"

Override draggability for this specific task

resizable
boolean"true"

Override resizability for this specific task

tooltip
ReactNode | ((task: GanttTask) => ReactNode)

Custom tooltip content for this task

data
Record<string, unknown>

Arbitrary extra data accessible in templates

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