ガントチャートGanttExperimental

Gantt / resource timeline: resource rows × a horizontal time axis with bars positioned by start/end and lane-packed within a row so overlapping bars stack instead of covering each other. Day-column gridlines + date headers, a sticky row-label gutter, an optional today line, and a contained horizontal scroll. Owns the time math (pass startDate/endDate + rows + items); today is injectable (SSR-safe). Bars are focusable buttons with a composed accessible name. For project schedules, production lines, room/equipment timelines, delivery/route plans and any rows-over-time view.

プレビュー

21
22
23
24
6/25
26
27
28
第1ライン組立
第2ライン塗装
第3ライン検査

バーをクリックで選択。第2ラインの B-201 と B-202 は期間が重なり、行内で上下に詰めて表示。今日(6/24)に縦線。

Props

表は横にスクロールできます
プロパティ初期値説明
rowsGanttRow[]-Resource lanes (left axis): { id, label, sublabel? }.
itemsGanttItem[]-Bars: { id, rowId, start, end, label, tone?, ariaLabel? }. start/end are 'YYYY-MM-DD' / 'YYYY-MM-DDTHH:mm' / Date. Overlapping bars in a row stack into lanes.
startDate / endDatestring | Date-Visible time window. The component computes the day columns and bar positions.
todaystring | Date-Date marked with a vertical line. Injectable so render stays SSR-safe (no internal new Date()).
laneHeightnumber28Height (px) of one bar lane.
rowLabelWidthnumber120Width (px) of the sticky row-label gutter.
dayWidthnumber44Min width (px) per day column (drives horizontal scroll).
onSelectItem(item) => void-A bar clicked.
labelReactNode-Accessible name for the chart.

Usage

import { Gantt, type GanttRow, type GanttItem } from "@gunjo/ui"

const rows: GanttRow[] = [
  { id: "l1", label: "第1ライン", sublabel: "組立" },
  { id: "l2", label: "第2ライン", sublabel: "塗装" },
]

const items: GanttItem[] = [
  { id: "j1", rowId: "l1", start: "2026-06-22", end: "2026-06-24", label: "A-101", tone: "info" },
  { id: "j3", rowId: "l2", start: "2026-06-22", end: "2026-06-25", label: "B-201", tone: "success" },
  { id: "j4", rowId: "l2", start: "2026-06-23", end: "2026-06-26", label: "B-202", tone: "warning" }, // overlaps → stacks
]

<Gantt
  rows={rows}
  items={items}
  startDate="2026-06-21"
  endDate="2026-06-29"
  today="2026-06-24"          // injectable — SSR-safe
  onSelectItem={(i) => openJob(i)}
/>

使用コンポーネント