columns prop.
Default columns
When you omit thecolumns prop, the component uses defaultColumns, which you can also import and extend:
| id | Header | Description |
|---|---|---|
text | Task | Task name with expand/collapse toggle for summary tasks |
start | Start date | Formatted start date |
end | End date | Formatted end date |
duration | Duration | Duration in durationUnit units |
progress | Progress | Numeric progress percentage |
add-task | — | Button to add a new task at this level |
The columns prop
Pass an array of column config objects to replace the default grid.
Array of column definitions to display in the grid. Pass
false to hide the grid entirely.Hiding the grid
Column config fields
Field name on the task object to read values from. Use any built-in id (
'text', 'start', 'end', 'duration', 'progress') or any custom field name on your task objects.Column heading text, or a header config object. Pass an object with a
cell property to render a custom React component in the header cell (useful for action buttons like “Add task”).Fixed pixel width for the column. Mutually exclusive with
flexgrow.Flex-grow factor. Columns with
flexgrow fill the available grid width proportionally. A column with flexgrow: 2 gets twice the space of one with flexgrow: 1.Horizontal alignment of cell content.
When
true, clicking the column header sorts the task list by this field.Custom React component to render inside each data cell. Receives the full task object as
data and the Gantt API as api.Inline editor configuration. When set, clicking a cell in this column opens an in-place editor. See inline editors below.
Sizing: fixed vs. flex columns
- Fixed widths
- Flex widths
Every column has a fixed pixel
width. The grid has a fixed total width.Custom cell renderers
Provide acell component to render any content in a column cell.
Custom columns from task fields
Any field present on your task objects can be used as a columnid.
Inline editors
Theeditor field on a column definition activates in-place editing when a user clicks a cell.
Built-in editor types include
'text', 'date', 'number', and 'combo'. The full task editor dialog (opened from the context menu or toolbar) is a separate <Editor> component.Sorting columns
Setsort: true on any column to make the header clickable for sorting.
HeaderMenu for toggling column visibility
HeaderMenu is a ready-made right-click menu for column headers that lets users show and hide columns at runtime. Import it from the package and wrap <Gantt>.