@jaeungkim/gantt-chart

GanttProps

every prop the component accepts

GanttProps is the full prop surface of ReactGanttChart. It and every type named in the tables below are exported from the package root, apart from Dayjs, ReactNode and React.MouseEvent, which come from dayjs and react:

import { ReactGanttChart, type GanttProps } from '@jaeungkim/gantt-chart';

Every prop is optional. The Default column carries the value the component actually falls back to; none means the prop has no fallback and the feature it drives stays off.

Data

PropTypeDefaultDescription
tasksTask[][]The task array. See Task data.
onTasksChange(updatedTasks: Task[]) => voidnoneFires with the whole array after any committed edit. See Editing tasks.

Layout and size

PropTypeDefaultDescription
heightnumber | string600Chart height, a number in px or any CSS length. See Quick start.
widthnumber | string"100%"Chart width, a number in px or any CSS length. See Quick start.
classNamestringnoneAppended to the container's gantt-container class. See Theming.

Task list

PropTypeDefaultDescription
showTaskListbooleancolumns !== undefinedShows the left pane. See Task list and hierarchy.
columnsGanttColumn[]DEFAULT_COLUMNS — Name / Start / EndColumn definitions for the pane. See Task list and hierarchy and GanttColumn.

Hierarchy and grouping

PropTypeDefaultDescription
hierarchybooleanfalseDerives depth and summary rows from parentId. See Task list and hierarchy.
collapsedIdsstring[]none — the chart keeps its own listControlled collapsed set. See Task list and hierarchy.
defaultCollapsedIdsstring[][]Uncontrolled seed, read once on mount. See Task list and hierarchy.
onCollapsedChange(collapsedIds: string[]) => voidnoneFires on every collapse toggle, controlled or not. See Task list and hierarchy.
groupByGanttGroupBynoneGroups rows into swimlanes. See Grouping and swimlanes and GanttGroupBy.
ungroupedLabelstring"Ungrouped"Header label for tasks with no group value. See Grouping and swimlanes.

Timeline and range

PropTypeDefaultDescription
defaultScaleGanttScaleKey"month" — only when no scale is stored under storageKeySeed scale for a fresh session. See The timeline.
visibleStartstringnone — the range fits the tasksPins the timeline's start to this ISO date. See The timeline.
visibleEndstringnone — the range fits the tasksPins the timeline's end to this ISO date. See The timeline.
showNonWorkingDaysbooleantrueShades weekends and holidays. See The timeline.
holidaysstring[]none — no dates are treated as holidaysISO date strings shaded as non-working. See The timeline.
isNonWorkingDay(date: Dayjs) => booleannone — the weekend plus holidays check is usedReplaces the built-in non-working-day test. See The timeline.
markersGanttMarker[][]Labelled vertical lines at given dates. See The timeline and GanttMarker.
rangeBandsGanttRangeBand[][]Shaded bands covering a date range. See The timeline and GanttRangeBand.
onRangeChange(range: GanttDateRange) => voidnoneFires whenever the rendered range changes. See The timeline.

Zoom and scrolling

PropTypeDefaultDescription
zoomOnWheelbooleanfalseCtrl/Cmd + wheel steps through the scale ladder. See The timeline.
infiniteScrollbooleanfalseGrows the rendered range when either end is approached. See The timeline.
initialScrollTo"today" | stringnoneScrolls once, after the timeline first renders. See Imperative API.
autoScrollOnDragbooleantrueA bar drag at a viewport edge scrolls the timeline. See Editing tasks.

Editing permissions

PropTypeDefaultDescription
readOnlybooleanfalseBlocks moving, resizing and progress dragging on every task. See Editing tasks.
allowMoveboolean!readOnlyAllows moving bars, overriding readOnly. See Editing tasks.
allowResizeboolean!readOnlyAllows resizing bars, overriding readOnly. See Editing tasks.
allowProgressChangeboolean!readOnlyAllows dragging the progress handle, overriding readOnly. See Editing tasks.
allowTaskCreateboolean!readOnlyAllows drawing a new task on empty row space. See Editing tasks.
allowRowReorderbooleanfalseAllows dragging a task list row to reorder and re-parent. See Reordering rows.
minDatestringnoneEarliest ISO date any bar may be dragged to. See Editing tasks.
maxDatestringnoneLatest ISO date any bar may be dragged to. See Editing tasks.

Dependencies

PropTypeDefaultDescription
allowLinkCreateboolean!readOnlyAllows drawing dependencies between bars. See Dependencies.
allowLinkDeleteboolean!readOnlyAllows selecting and deleting dependency arrows. See Dependencies.
onDependencyCreate(change: GanttDependencyChange) => boolean | voidnoneRuns before a drawn link is applied; false rejects it. See Dependencies.
onDependencyDelete(change: GanttDependencyChange) => boolean | voidnoneRuns before an arrow is removed; false keeps it. See Dependencies.

Scheduling

PropTypeDefaultDescription
schedulingPolicySchedulingPolicy"off"How a move propagates to successors. See Scheduling.
onSchedulingCycle(taskIds: string[]) => voidnoneFires with the ids caught in a dependency cycle. See Scheduling.
workingCalendarbooleanfalseRoutes every date calculation through a working-day calendar. See Scheduling.
criticalPathbooleanfalseComputes the critical path and fills in the slack fields. See Scheduling.

Rendering

PropTypeDefaultDescription
renderBarGanttBarRenderernone — the built-in bar is usedReplaces the bar node entirely. See Custom rendering and Renderers.
renderTooltipGanttTooltipRenderernone — the built-in tooltip is usedReplaces the hover and drag tooltip node. See Custom rendering and Renderers.
renderHeaderCellGanttHeaderCellRenderernone — the built-in header cell is usedReplaces a timeline header cell in both rows. See Custom rendering and Renderers.
renderBaseline(task: TaskTransformed) => ReactNodenone — the built-in baseline bar is usedReplaces the baseline bar for tasks carrying baselineStart. See Scheduling.
showTooltipbooleantrueShows the hover and drag tooltips. See Custom rendering.

Events

PropTypeDefaultDescription
onTaskClick(task: TaskTransformed, event: React.MouseEvent) => voidnoneFires on a bar or row click, not after a drag. See Events and cancellable changes.
onTaskDoubleClick(task: TaskTransformed, event: React.MouseEvent) => voidnoneFires on a double click. See Events and cancellable changes.
onTaskSelect(task: TaskTransformed | null) => voidnoneFires when the selection changes, null on an empty-timeline click. See Events and cancellable changes.
selectablebooleanonTaskSelect !== undefinedTurns click-to-select and its highlight on. See Events and cancellable changes.
onBeforeTaskChangeGanttBeforeChangeHandlernoneRuns before a move, resize or progress change is written, and can cancel it. See Events and cancellable changes and Changes.
onTaskCreate(draft: GanttTaskDraft) => voidnoneFires with the range drawn on empty row space. See Editing tasks.
onReorder(change: GanttReorderChange) => void | booleannoneRuns before a row drop is committed; false cancels it. See Reordering rows.

Locale and theme

PropTypeDefaultDescription
localestringnone — the built-in English labels are usedBCP 47 tag for every date label. See Locale and date formats.
formatsGanttFormatOverridesnone — the locale's labels are usedPer-scale tick / header / tooltip label overrides. See Locale and date formats.
firstDayOfWeeknumbernone — week grouping is off0 = Sunday .. 6 = Saturday, groups the week scale's top header. See Locale and date formats.
themeGanttThemenone — no theme class is attached'light', 'dark' or 'system'. See Theming.

Storage

PropTypeDefaultDescription
storageKeystring"gantt-scale"sessionStorage key the scale selection is stored under. See The timeline.
historyLimitnumber100Undo steps kept; 0 turns undo off. See Imperative API.

Defaults that are not what they look like

  • showTaskList has no fixed default. Left out, the pane is on exactly when columns is given. Passing columns alone turns the pane on; passing showTaskList: true alone shows it with DEFAULT_COLUMNS.
  • selectable has no fixed default either. Left out, selection is on exactly when onTaskSelect is given. Pass true for the highlight without a callback, false to turn it off entirely.
  • allowMove, allowResize, allowProgressChange, allowTaskCreate, allowLinkCreate, allowLinkDelete default to !readOnly, not to true. A task's own flag of the same name wins over the chart-level one, and a task's own readOnly sits between them. See GanttInteractionConfig.
  • allowTaskCreate on its own draws nothing: onTaskCreate must also be given.
  • defaultScale is a seed, not a controlled value. A scale the user picked is saved under storageKey in sessionStorage and wins on remount, and changes to the prop after mount are ignored.
  • collapsedIds and defaultCollapsedIds are the controlled and uncontrolled halves of one value. Passing collapsedIds makes the chart show that list and stop tracking its own; onCollapsedChange still fires in both modes.
  • theme left out attaches no theme class at all — the host app decides. 'system' resolves to null during server rendering and the first hydration render, then to the real setting.
  • historyLimit: 0 does not mean unlimited. It empties the stack and turns undo off.
  • storageKey is one key for the whole page. Two charts that leave it at "gantt-scale" share a scale, and the last change made applies to both.
  • visibleStart and visibleEnd are independent. Pinning one end also stops infiniteScroll from extending the range on that side; the other side still extends.
  • workingCalendar builds its calendar from holidays and isNonWorkingDay, the same configuration that drives showNonWorkingDays shading.

Notes

  • DEFAULT_COLUMNS is an internal constant, not a public export. It names the fallback columns in the table above but cannot be imported from the package — pass your own columns array instead. See Task list and hierarchy.
  • Dayjs comes from the dayjs package, and ReactNode / React.MouseEvent from react. None of the three is re-exported from this package.
  • ReactGanttChart also takes a ref of type GanttHandle for scrolling, zooming, undo/redo and PNG export. It is not part of GanttProps — see GanttHandle.

On this page