The critical path is the longest chain of dependent tasks that determines the earliest possible project completion date. Any delay on a critical task directly delays the project end. SVAR React Gantt PRO calculates the critical path and visually highlights critical tasks and links.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/svar-widgets/react-gantt/llms.txt
Use this file to discover all available pages before exploring further.
The criticalPath prop
Pass a criticalPath configuration object to enable critical path analysis.
| Prop | Type | Default | Description |
|---|---|---|---|
criticalPath | { type: 'flexible' | 'strict' } | null | null | Enables critical path when set. null disables it. |
Calculation modes
| Mode | Description |
|---|---|
'flexible' | A task is critical if delaying it would push the project past projectEnd. Tasks near the end of the schedule are highlighted even if there is some float. |
'strict' | Only tasks with zero total float are considered critical. This is the classical CPM (Critical Path Method) definition. |
Set
projectStart and projectEnd alongside criticalPath so the algorithm has a defined project window to calculate float against.How critical path is calculated
The algorithm performs a forward and backward pass across the dependency graph:- Forward pass — calculates the earliest start and finish for every task, starting from
projectStart. - Backward pass — calculates the latest allowable start and finish for every task, working backwards from
projectEnd. - Float calculation — total float = latest start − earliest start.
- Tasks and links where float equals zero (strict mode) or falls below the threshold (flexible mode) are marked as critical.
Visual highlighting
WhencriticalPath is enabled, the Gantt automatically applies a distinct visual style to:
- Critical task bars — rendered in a red/accent colour.
- Critical dependency links — rendered in a matching accent colour to trace the critical chain.
Toggling critical path at runtime
BecausecriticalPath is a reactive prop, you can toggle it on and off without remounting the component:
Full example
This example mirrors theProCriticalPath demo, allowing the user to switch between flexible and strict modes and adjust project boundaries: