Skip to content

Gantt Chart for React

A React Gantt chart puts a plan on a timeline, with progress, dependency arrows, milestones and a today line. Pass tasks as a readonly GanttTask[]: an id, a label, a start and an end day, plus optional progress and dependencies.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/gantt-chart.json

Sprint 14

Audit chart tokens
Token cleanup
Gantt zoom levels
Cohort grid keyboard
Map projection
Sprint review
Release 0.9
Use the up and down arrow keys to move between tasks, left and right to scroll the timeline, Home and End for the first and last task, T for today, plus and minus to zoom.

Product launch plan

Four phases, twelve tasks. Hover a bar: its arrows light up and the tooltip lists dates, progress and what it waits for. Collapse a phase and the rows below glide up. It opens at the zoom that fits the whole plan; switch the zoom and the timeline glides around the date in the middle, and an edge fades while there is more plan beyond it.

Sheen 2.0 launch plan

Feb – Apr 2026

52%done
  • Discovery
  • Design
  • Build
  • Launch

Files to copy

14 folders · 30 files · 4 packages
From theme/src/
  • components/charts/{gantt-chart.tsx, calendar-heatmap.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-pointer.tsx, chart-tip.tsx, chart-utils.ts, heatmap.tsx}
  • components/charts/chart-parts/
  • components/charts/gantt/
  • components/charts/heatmap/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/segmented/
  • components/skeleton/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-direction.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}
  • motion/tokens.ts
  • lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/gantt-chart.jsonRegistry item: gantt-chart. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/spinner/
  • components/toast/
  • lib/state-light.tsx
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/toast.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".

Sprint, by day

defaultScale="day" for a two-week sprint: weekends are shaded, today’s date is highlighted in the header and the plan stretches to fill the width. Click a bar (or press Enter on it) to open the task.

Sprint 14

Mar 16 – 27, 2026 (two weeks)

Props

PropTypeDefaultDescription
tasks (required)readonly GanttTask[]NoneThe tasks: { id, label, start, end?, progress?, dependencies?, milestone?, group?, color?, assignee? }. end is the last day, inclusive; milestone: true marks a single day (and ignores end).
scaleGanttScaleNoneCurrent zoom level of the time axis; pass it with onScaleChange to control it.
defaultScale"auto" | GanttScale"auto"Sets the starting zoom when uncontrolled.
onScaleChange((scale: GanttScale) => void)NoneCalled with "day", "week" or "month" when the zoom changes (controlled scale).
toolbarbooleantrueShow the Day / Week / Month switch and the Today button.
todaystring | Date | nullthe current dateSets where the today line goes.
localestringthe browser'sLocale of dates, numbers and the first day of the week.
labelWidthnumberfits the names, up to a third of the chartWidth of the task-name column in px.
collapsiblebooleantrueLets the person collapse and expand groups.
defaultCollapsedreadonly string[][]Groups that start collapsed.
onTaskClick((task: GanttTask) => void)NoneCalled with a task on click, Enter or Space.
emptyStateReactNodeNoneShown when there are no tasks.
labelsPartial<GanttChartLabels>defaultGanttChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultGanttChartLabels. All 22 keys of GanttChartLabels are listed in the key table under the props table.
aria-label (required)stringNoneNames the chart for assistive tech (required).
classNamestringNoneAdds extra classes to the outer element.
GanttChartLabels keys and English defaults (22)
Pass any key in labels; the rest keep the defaults of defaultGanttChartLabels.
KeyEnglish default
instructionsUse the up and down arrow keys to move between tasks, left and right to scroll the timeline, Home and End for the first and last task, T for today, plus and minus to zoom.
roleDescriptionGantt chart
todayToday
scaleLabelTimeline zoom
dayDay
weekWeek
monthMonth
taskTask
duration(n) => (n === 1 ? "1 day" : `${n} days`)
progress(p) => `${p} done`
after(names) => `After ${names}`
milestoneMilestone
tasks(n) => (n === 1 ? "1 task" : `${n} tasks`)
hintTap a bar for details
groupPhase
startStart
endEnd
daysDays
ownerOwner
dependsOnDepends on
doneDone
noneNone

GanttTable props

PropTypeDefaultDescription
labelsPartial<GanttChartLabels>defaultGanttChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultGanttChartLabels. All 22 keys of GanttChartLabels are listed in the key table under the props table.
localestringthe browser'sLocale of dates, numbers and the first day of the week.
tasks (required)readonly GanttTask[]NoneThe tasks: { id, label, start, end?, progress?, dependencies?, milestone?, group?, color?, assignee? }. end is the last day, inclusive; milestone: true marks a single day (and ignores end).
captionstringNoneSets a visually hidden caption that names the table.
emptyStateReactNodeNoneShown when there are no tasks.

Keyboard

KeysAction
TabThe toolbar (Today, then the zoom switch), then the phase toggles, then the timeline (one stop).
↑/↓Previous / next task; it scrolls into view.
Home/EndFirst / last task.
←/→Scroll the timeline by one column (a day, a week or a month).
TJump to today.
+/−Zoom in / out (month → week → day).
Enter/SpaceCall onTaskClick for the active task.
EscapeClear the active task.

Accessibility

  • The timeline is one focusable figure (role description “Gantt chart”); each keyboard move is announced once: name, dates, duration, progress, dependencies and owner.
  • Phase rows are disclosure buttons with aria-expanded.
  • Colors follow the phase in a fixed slot; the phase also shows as a dot and a label, never by color alone.
  • The Table view lists every task with start, end, duration, progress, owner and dependencies.
  • Right-to-left pages mirror the timeline: time runs leftwards and the names sit on the right.
  • Reduced motion: no cascade, no glides; zoom and scrolling jump.

All exports on this page

  • GanttChart — Gantt chart: tasks as bars on a timeline, with progress, finish-to-start dependency arrows, milestones, collapsible phases and a today line.
  • GanttTable — Every task as a row: phase, start, end, duration, progress, owner and what it waits for.
  • defaultGanttChartLabels — The built-in English strings of GanttChart; spread it into your own labels and change what you need.

When to use the gantt chart

  • Use it as a project timeline chart: a plan with tasks as bars on a timeline, progress fills, finish-to-start dependency arrows, milestones and a today line, such as a product launch schedule.
  • Group tasks by phase or team: groups become collapsible rows and set the bar color, so a long plan can fold down to its phases for a status meeting.
  • Switch between day, week and month zoom with the toolbar, and use scale with onScaleChange when your own control should drive it; it opens at the most detailed zoom that fits the plan.
  • Skip it when you only need to show one task's completion, where Progress is enough, or when you need only a due date, where a Calendar or a plain Badge is lighter.
  • Pair it with ChartCard and GanttTable for a text view, plus Dialog or Drawer opened from onTaskClick to edit a task.

Frequently asked questions

48 charts pages in all: browse them on Charts.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .