mantine-gantt
A gantt chart component for mantine
Installation
Usage
Custom columns & click-to-open modal
Pass columns to customize the left panel (the default columns are Task Name, Start,
End and Duration). Use onTaskClick to react to clicks - here it opens a modal with
task details.
Grouping tasks
Set parentId on a task and it becomes a child row. A task that has children renders as a
summary bar: it spans its whole subtree and shows a duration-weighted average progress, so the
dates you give a parent are only a placeholder. Nesting goes as deep as you need. Rows are
collapsible via the chevron - defaultExpandedIds picks which parents start open (omit it and
everything is open), and onToggleExpand reports each toggle.
View modes
viewMode switches the timeline scale between day (default), week and month. It shrinks
the day column derived from columnWidth rather than changing the underlying day grid, so drags
still snap to whole days. weekStart controls the header's week numbering and the grid separators.
Critical path & baselines
highlightCriticalPath runs CPM over the dependency graph and paints the zero-slack tasks and
links with criticalPathColor. Independently, any task with a baseline gets a thin planned bar
underneath the actual one - turn those off with showBaselines={false}.
Milestones
Set type: 'milestone' on a task to render it as a diamond instead of a bar. A milestone is a
zero-length marker pinned to its start day - it can be dragged and linked like any task, but it
cannot be resized and its duration is ignored for rendering. Milestones participate in the
critical path calculation and in auto-scheduling like regular tasks.
Auto-scheduling
With autoSchedule, moving or resizing a task pushes every finish-to-start successor so it never
starts before its predecessors end. The cascade is transitive (a whole chain shifts together) and
picks the latest predecessor when a task has several dependencies. It works with drags, resizes
and keyboard nudges alike. Turned off by default.
Deleting dependency links
Click a dependency arrow to delete that link. The component removes the source id from the
target's dependencies and fires onLinkDelete(fromTaskId, toTaskId) alongside onTasksChange,
mirroring how link creation works.
Controlled and uncontrolled
Pass defaultTasks and the component owns the task list (uncontrolled) - this is what the demos
above do. Pass tasks together with onTasksChange and your own state is the single source of
truth (controlled): the component keeps no copy, so a dragged bar only moves once the new tasks
prop arrives. Use this mode to drive the chart from a query cache, a store, or an undo/redo stack.
onTaskUpdate, onLinkCreate and onLinkDelete keep working in both modes - they fire
alongside onTasksChange, not instead of it.
Migrating from 0.2.x: <Gantt tasks={x} /> becomes <Gantt defaultTasks={x} />.