<Gantt>.
The scales prop
scales is an array of scale row definitions, ordered from largest time unit (top) to smallest (bottom). Each entry renders as one header row above the task bars.
Scale object fields
Time unit for this row. Built-in values:
'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'. Custom units can be registered with registerScaleUnit.How many units each cell spans. For example
{ unit: 'day', step: 7 } gives one cell per week without using the 'week' unit.Label displayed in each cell. Accepts a strftime-style format string or a function that receives the cell’s start and end dates and returns a string.Common format tokens:
| Token | Output |
|---|---|
%Y | 4-digit year |
%F | Full month name |
%M | Short month name |
%j | Day of month |
%H | Hour (24h) |
%i | Minutes |
%W | ISO week number |
%Q | Quarter number |
%w | Week number (locale) |
Function that returns a CSS class name for each cell. Use it to highlight weekends or other special periods.
Common scale configurations
Cell sizing
Width in pixels of the smallest-unit cell. All timeline columns are this wide. Increase it to make bars less compressed.
Height in pixels of each task row, including the task bar.
Height in pixels of each scale header row. Applies to every scale row.
Fixed date range
By default the timeline adjusts its start and end to fit the tasks (autoScale: true). You can pin the visible range with start and end.
Left edge of the visible timeline. When
null the timeline starts before the earliest task.Right edge of the visible timeline. When
null the timeline ends after the latest task.When
true the timeline expands automatically to always fit all tasks. Set to false when providing a fixed start / end.lengthUnit
lengthUnit controls the granularity of the smallest cell on the timeline. It affects how far a task bar moves when you drag it one cell, and how the scroll position snaps.
The unit that one cell column represents on the timeline. Must match (or be finer than) the smallest
unit in your scales array.Zoom
Thezoom prop enables interactive zooming. Hold Ctrl and scroll the mouse wheel over the chart to zoom in and out.
- Default zoom
- Custom zoom levels
Pass The built-in levels cycle through year → quarter/month → month/week → month/day → day/hour scales.
zoom={true} to use the built-in zoom levels.Zoom level object fields
The scale rows to display at this zoom level.
The narrowest cell width this level will allow before zooming in to the next finer level.
The widest cell width this level will allow before zooming out to the next coarser level.
The
level field on the zoom config object sets the initial level index. Levels are 0-based from the coarsest to the finest.Custom scale units
Register a custom unit name withregisterScaleUnit before rendering the component.
Props reference
| Prop | Type | Default | Description |
|---|---|---|---|
scales | IScale[] | month + day | Header row definitions |
zoom | boolean | IZoomConfig | false | Enables Ctrl+scroll zoom |
lengthUnit | string | 'day' | Smallest timeline cell unit |
durationUnit | string | 'day' | Unit for numeric duration values |
cellWidth | number | 100 | Width of each timeline cell in px |
cellHeight | number | 38 | Height of each task row in px |
scaleHeight | number | 36 | Height of each scale header row in px |
start | Date | null | null | Fixed left boundary of the timeline |
end | Date | null | null | Fixed right boundary of the timeline |
autoScale | boolean | true | Auto-expand timeline to fit all tasks |