Skip to content

API Overview ​

Components & hooks ​

ExportDescription
GanttChartMain chart component
useSidebarLayoutBuild a custom shell with draggable panels
useGanttTimelineTimeline metrics inside chart tree (required for __timeline__ cells)
useGanttTimelineOptionalSame; returns null outside GanttChart
useGanttDisplayTimezoneCurrent display timezone inside chart tree
useVirtualColumnSegmentsVirtualized column segments with caching
VirtualColumnCellMemoized cell wrapper for virtual segments
useBufferedSegmentCacheGeneric cache for buffered timeline segments

Classes ​

ExportDescription
TaskStoreExternal task store with per-task version counters

Zoom & scale ​

ExportDescription
ZOOM_LEVELSDefault zoom order
PRESET_SCALESAll built-in scale presets
resolveScale(id)Resolve a scale id (falls back to day)
resolveScales(ids?)Resolve ordered list of scales
getColumnWidth(scaleOrId, override?)Column width in px
computeTimelineRange(...)Compute timeline start/end and column count
nextZoomLevel(current, 'in' | 'out', availableIds?)Step zoom

Dates ​

ExportDescription
toDate(value)Parse ISO string or Date
addUnit(date, amount, zoom)Add scale units
diffUnits(later, earlier, zoom)Difference in scale units
formatRe-exported from date-fns

Package exports ​

tsx
import { GanttChart } from 'react-gantt-lib';
import 'react-gantt-lib/styles.css';

Agent/LLM reference: react-gantt-lib/llm.txt (also on npm).

Released under the MIT License.