GooseUI

Components

Gantt Chart

New

A Gantt chart for one day or any span of hours. Each row shows the planned interval and the actual one as two bars of different weight. The server computes every bar, groups collapse on native <details>, and chosen intervals such as off hours get hatched. The only client part is the live "now" line. On narrow screens the scale scrolls sideways while the name column stays put.

Browser Support

<details>

Expands and collapses task groups.

Your browser:
color-mix()

Mixes the group label background.

Your browser:

Preview

Click a group header to collapse it, this works without JavaScript. The "now" line follows your local clock and appears after the page loads.

PlannedActualNightNow
Job
Data exportRunningPlanned 10:00–16:00, Actual 10:00–14:00
Night jobs2
Database backupDonePlanned 02:00–03:00, Actual 02:05–03:20
Search reindexDonePlanned 04:00–05:30, Actual 04:00–04:50
Daytime2
Daily reportsLatePlanned 08:00–09:00, Actual 08:40–10:10
Catalog syncFailedPlanned 12:00–13:00, Actual 12:00–12:20
Evening2
Email digestPlannedPlanned 18:00–18:30
Cache cleanupPlannedPlanned 21:00–21:45

Installation

npx shadcn@latest add @gooseui/gantt-chart
pnpm dlx shadcn@latest add @gooseui/gantt-chart
yarn dlx shadcn@latest add @gooseui/gantt-chart
bunx --bun shadcn@latest add @gooseui/gantt-chart

Usage

import { GanttChart } from "@/components/ui/gantt-chart"

const h = (hours: number, minutes = 0) => hours * 60 + minutes

export default function Example() {
  return (
    <GanttChart
      shaded={[[0, h(7)], [h(23), h(24)]]}
      items={[
        { id: "backup", label: "Database backup", group: "Night", planned: [h(2), h(3)], actual: [h(2, 5), h(3, 20)], status: "done" },
        { id: "reports", label: "Daily reports", group: "Day", planned: [h(8), h(9)], actual: [h(8, 40), h(10, 10)], status: "delayed" },
        { id: "digest", label: "Email digest", planned: [h(18), h(18, 30)], status: "planned" },
      ]}
    />
  )
}

Examples

Range with Date objects

When start is a Date, Date values in items are measured from it. timeZone and locale control the labels, and a fixed now pins the line without any client code. Set timeZone: the chart is computed on the server, and without it Dates are read in the server zone.

PlannedActualBreakNow
Station
AssemblyPlanned 08:00–12:00, Actual 08:10–11:50
PaintingPlanned 10:00–15:00, Actual 10:30–13:15
PackingPlanned 14:00–19:00
Quality checkPlanned 16:00–20:00
const at = (hh: number, mm = 0) => new Date(Date.UTC(2026, 10, 23, hh, mm))

<GanttChart
  start={at(8)}
  end={at(20)}
  timeZone="UTC"
  tickStep={120}
  now={at(13, 15)}
  shaded={[[at(12), at(13)]]}
  labels={{ name: "Station", shaded: "Break" }}
  items={[
    { id: "a", label: "Assembly", planned: [at(8), at(12)], actual: [at(8, 10), at(11, 50)] },
    { id: "b", label: "Painting", planned: [at(10), at(15)], actual: [at(10, 30), at(13, 15)] },
    { id: "c", label: "Packing", planned: [at(14), at(19)] },
  ]}
/>

Fact only, collapsed group

Rows may have only planned or only actual. defaultCollapsed renders groups closed, and now={null} hides the line and drops the client part.

Job
Night jobs2
Database backupActual 02:00–03:15
Search reindexActual 04:00–05:00
Daytime2
Daily reportsActual 08:30–10:00
Catalog syncActual 12:00–14:00
<GanttChart
  now={null}
  tickStep={180}
  defaultCollapsed={["night"]}
  showLegend={false}
  groups={[
    { id: "night", label: "Night jobs" },
    { id: "day", label: "Daytime" },
  ]}
  items={[
    { id: "backup", label: "Database backup", group: "night", actual: [120, 195] },
    { id: "reports", label: "Daily reports", group: "day", actual: [510, 600] },
  ]}
/>

Props

PropTypeDefaultDescription
itemsGanttItem[]-Rows: id, label, group, planned and actual intervals, status
startnumber | Date0Range start: minutes or a Date
endnumber | Date1440Range end: minutes or a Date
groups{ id: string; label: string }[]-Group titles and order
defaultCollapsedstring[]-Group ids rendered closed
tickStepnumber60Tick step in minutes
now"auto" | number | Date | null"auto""auto" follows the clock, a time pins the line, null hides it
shaded[number | Date, number | Date][]-Hatched intervals
localestring"en-US"Locale for time labels with a Date range
timeZonestring-IANA time zone for reading Dates and labels. Without it the server zone is used
rowHeightnumber36Row height in px
labelWidthnumber200Width of the name column in px
minTimelineWidthnumber640Scale width at which horizontal scroll starts, px. Tick labels are thinned for it
showLegendbooleantrueShow the legend
labels{ name?; planned?; actual?; now?; shaded?; status? }-Column, legend and status texts
classNamestring-Additional CSS classes

Features

  • Minutes or Dates: numbers are minutes from the range start, Dates are measured from a Date start
  • Plan and fact: a light dashed bar for the plan and a solid thin bar for the fact
  • Groups on <details>: headers collapse rows without JavaScript and show the overall span
  • Now line: the only client part: with now="auto" it follows the clock after mount
  • Sticky names: the name column stays in place while the scale scrolls
  • Screen readers: every row has hidden text with its intervals
type GanttItem = {
  id: string
  label: string
  group?: string
  planned?: [number | Date, number | Date]
  actual?: [number | Date, number | Date]
  status?: "planned" | "running" | "done" | "delayed" | "failed"
}