Top Related Projects
GPL version of Javascript Gantt Chart
Gantt Gantt Gantt Timeline Schedule Calendar [ javascript gantt, js gantt, projects gantt, timeline, scheduler, gantt timeline, reservation timeline, react gantt, angular gantt, vue gantt, svelte gantt, booking manager ]
🍞📅A JavaScript calendar that has everything you need.
A datepicker for twitter bootstrap (@twbs)
Quick Overview
Gantt-task-react is a React component library for creating interactive Gantt charts. It provides a customizable and feature-rich solution for visualizing project timelines, tasks, and dependencies in a Gantt chart format, making it ideal for project management and scheduling applications.
Pros
- Highly customizable with numerous styling and configuration options
- Supports task dependencies and linking
- Includes features like zooming, scrolling, and task selection
- Written in TypeScript, providing type safety and better developer experience
Cons
- Limited documentation and examples for advanced use cases
- May require additional styling effort to match specific design requirements
- Performance might degrade with a large number of tasks
- Lacks built-in support for some advanced Gantt chart features (e.g., resource allocation)
Code Examples
- Basic Gantt Chart:
import { Gantt, Task, ViewMode } from 'gantt-task-react';
const tasks: Task[] = [
{
start: new Date(2023, 0, 1),
end: new Date(2023, 0, 15),
name: 'Task 1',
id: 'Task 1',
progress: 45,
type: 'task',
},
// Add more tasks...
];
function App() {
return (
<Gantt tasks={tasks} viewMode={ViewMode.Month} />
);
}
- Customizing the Gantt Chart:
import { Gantt, Task, ViewMode } from 'gantt-task-react';
function App() {
return (
<Gantt
tasks={tasks}
viewMode={ViewMode.Week}
onDateChange={(task, start, end) => {
console.log(task, start, end);
}}
onProgressChange={(task, progress) => {
console.log(task, progress);
}}
onSelect={(task, isSelected) => {
console.log(task, isSelected);
}}
listCellWidth="200px"
columnWidth={60}
/>
);
}
- Adding Task Dependencies:
const tasks: Task[] = [
{
start: new Date(2023, 0, 1),
end: new Date(2023, 0, 15),
name: 'Task 1',
id: 'Task 1',
progress: 45,
type: 'task',
dependencies: ['Task 2'],
},
{
start: new Date(2023, 0, 16),
end: new Date(2023, 0, 31),
name: 'Task 2',
id: 'Task 2',
progress: 0,
type: 'task',
},
];
Getting Started
-
Install the package:
npm install gantt-task-react
-
Import and use the Gantt component in your React application:
import React from 'react'; import { Gantt, Task, ViewMode } from 'gantt-task-react'; import 'gantt-task-react/dist/index.css'; const tasks: Task[] = [ // Define your tasks here ]; function App() { return ( <div className="App"> <Gantt tasks={tasks} viewMode={ViewMode.Month} /> </div> ); } export default App;
-
Customize the Gantt chart as needed using the available props and event handlers.
Competitor Comparisons
GPL version of Javascript Gantt Chart
Pros of DHTMLX/gantt
- More comprehensive and feature-rich, offering a wide range of functionalities
- Extensive documentation and examples available
- Supports multiple views (Gantt, Grid, Timeline) and advanced features like resource management
Cons of DHTMLX/gantt
- Steeper learning curve due to its complexity
- Commercial license required for most use cases
- Larger file size and potentially higher performance overhead
Code Comparison
gantt-task-react:
import { Gantt, Task, ViewMode } from 'gantt-task-react';
const App = () => (
<Gantt tasks={tasks} viewMode={ViewMode.Day} />
);
DHTMLX/gantt:
gantt.init("gantt_here");
gantt.parse({
data: [
{id: 1, text: "Task #1", start_date: "2023-05-01", duration: 3},
{id: 2, text: "Task #2", start_date: "2023-05-04", duration: 2}
]
});
Both libraries offer Gantt chart functionality, but DHTMLX/gantt provides a more comprehensive solution with additional features and customization options. gantt-task-react is simpler to use and integrate into React applications, while DHTMLX/gantt offers a broader range of capabilities at the cost of increased complexity and licensing requirements.
Gantt Gantt Gantt Timeline Schedule Calendar [ javascript gantt, js gantt, projects gantt, timeline, scheduler, gantt timeline, reservation timeline, react gantt, angular gantt, vue gantt, svelte gantt, booking manager ]
Pros of gantt-schedule-timeline-calendar
- More feature-rich with advanced scheduling capabilities
- Supports multiple views (timeline, calendar, resource)
- Highly customizable with extensive API and event handling
Cons of gantt-schedule-timeline-calendar
- Steeper learning curve due to complexity
- Larger bundle size, potentially impacting performance
- Less focused on simple Gantt chart functionality
Code Comparison
gantt-schedule-timeline-calendar:
import { GSTCResult } from 'gantt-schedule-timeline-calendar';
const App = () => (
<GSTCResult config={config}>
<GSTC />
</GSTCResult>
);
gantt-task-react:
import { Gantt } from 'gantt-task-react';
const App = () => (
<Gantt tasks={tasks} />
);
gantt-schedule-timeline-calendar offers more configuration options and flexibility, while gantt-task-react provides a simpler, more straightforward implementation for basic Gantt chart functionality.
🍞📅A JavaScript calendar that has everything you need.
Pros of tui.calendar
- More comprehensive calendar functionality, including various view modes (daily, weekly, monthly)
- Extensive customization options and theming capabilities
- Robust documentation and examples
Cons of tui.calendar
- Steeper learning curve due to its complexity
- Larger bundle size, which may impact performance for simpler use cases
- Less focused on Gantt chart-specific features
Code Comparison
tui.calendar:
import Calendar from '@toast-ui/react-calendar';
const MyCalendar = () => (
<Calendar
view="week"
events={[
{ id: '1', calendarId: 'cal1', title: 'Event 1', start: '2023-05-01T10:00:00', end: '2023-05-01T12:00:00' },
]}
/>
);
gantt-task-react:
import { Gantt, Task, ViewMode } from 'gantt-task-react';
const tasks: Task[] = [
{ start: new Date(2023, 4, 1), end: new Date(2023, 4, 2), name: 'Task 1', id: '1', progress: 45, type: 'task' },
];
const MyGantt = () => <Gantt tasks={tasks} viewMode={ViewMode.Day} />;
tui.calendar offers a more feature-rich calendar component with various view options, while gantt-task-react provides a simpler, Gantt chart-focused solution. The code examples demonstrate the different approaches: tui.calendar uses a more complex event structure, while gantt-task-react focuses on task-specific properties.
A datepicker for twitter bootstrap (@twbs)
Pros of bootstrap-datepicker
- Widely adopted and well-established library with extensive documentation
- Seamless integration with Bootstrap, providing consistent styling
- Supports a wide range of date formats and localization options
Cons of bootstrap-datepicker
- Limited to date selection functionality, lacking task management features
- May require additional libraries for more complex project management needs
- Less suitable for visualizing project timelines or Gantt charts
Code Comparison
bootstrap-datepicker:
$('#datepicker').datepicker({
format: 'mm/dd/yyyy',
startDate: '-3d'
});
gantt-task-react:
<Gantt
tasks={tasks}
viewMode={ViewMode.Day}
onDateChange={onTaskChange}
onProgressChange={onProgressChange}
/>
The code snippets highlight the different focus of each library. bootstrap-datepicker is centered around date selection, while gantt-task-react provides a more comprehensive task management and visualization solution.
bootstrap-datepicker is ideal for simple date input needs, especially in Bootstrap-based projects. However, for project management and timeline visualization, gantt-task-react offers more specialized features and a richer set of components tailored for Gantt chart creation and task management.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
gantt-task-react
Interactive Gantt Chart for React with TypeScript.
Live Demo
Install
npm install gantt-task-react
How to use it
import { Gantt, Task, EventOption, StylingOption, ViewMode, DisplayOption } from 'gantt-task-react';
import "gantt-task-react/dist/index.css";
let tasks: Task[] = [
{
start: new Date(2020, 1, 1),
end: new Date(2020, 1, 2),
name: 'Idea',
id: 'Task 0',
type:'task',
progress: 45,
isDisabled: true,
styles: { progressColor: '#ffbb54', progressSelectedColor: '#ff9e0d' },
},
...
];
<Gantt tasks={tasks} />
You may handle actions
<Gantt
tasks={tasks}
viewMode={view}
onDateChange={onTaskChange}
onTaskDelete={onTaskDelete}
onProgressChange={onProgressChange}
onDoubleClick={onDblClick}
onClick={onClick}
/>
How to run example
cd ./example
npm install
npm start
Gantt Configuration
GanttProps
Parameter Name | Type | Description |
---|---|---|
tasks* | Task | Tasks array. |
EventOption | interface | Specifies gantt events. |
DisplayOption | interface | Specifies view type and display timeline language. |
StylingOption | interface | Specifies chart and global tasks styles |
EventOption
Parameter Name | Type | Description |
---|---|---|
onSelect | (task: Task, isSelected: boolean) => void | Specifies the function to be executed on the taskbar select or unselect event. |
onDoubleClick | (task: Task) => void | Specifies the function to be executed on the taskbar onDoubleClick event. |
onClick | (task: Task) => void | Specifies the function to be executed on the taskbar onClick event. |
onDelete* | (task: Task) => void/boolean/Promise | Specifies the function to be executed on the taskbar on Delete button press event. |
onDateChange* | (task: Task, children: Task[]) => void/boolean/Promise | Specifies the function to be executed when drag taskbar event on timeline has finished. |
onProgressChange* | (task: Task, children: Task[]) => void/boolean/Promise | Specifies the function to be executed when drag taskbar progress event has finished. |
onExpanderClick* | onExpanderClick: (task: Task) => void; | Specifies the function to be executed on the table expander click |
timeStep | number | A time step value for onDateChange. Specify in milliseconds. |
* Chart undoes operation if method return false or error. Parameter children returns one level deep records.
DisplayOption
Parameter Name | Type | Description |
---|---|---|
viewMode | enum | Specifies the time scale. Hour, Quarter Day, Half Day, Day, Week(ISO-8601, 1st day is Monday), Month, QuarterYear, Year. |
viewDate | date | Specifies display date and time for display. |
preStepsCount | number | Specifies empty space before the fist task |
locale | string | Specifies the month name language. Able formats: ISO 639-2, Java Locale. |
rtl | boolean | Sets rtl mode. |
StylingOption
Parameter Name | Type | Description |
---|---|---|
headerHeight | number | Specifies the header height. |
ganttHeight | number | Specifies the gantt chart height without header. Default is 0. It`s mean no height limitation. |
columnWidth | number | Specifies the time period width. |
listCellWidth | string | Specifies the task list cell width. Empty string is mean "no display". |
rowHeight | number | Specifies the task row height. |
barCornerRadius | number | Specifies the taskbar corner rounding. |
barFill | number | Specifies the taskbar occupation. Sets in percent from 0 to 100. |
handleWidth | number | Specifies width the taskbar drag event control for start and end dates. |
fontFamily | string | Specifies the application font. |
fontSize | string | Specifies the application font size. |
barProgressColor | string | Specifies the taskbar progress fill color globally. |
barProgressSelectedColor | string | Specifies the taskbar progress fill color globally on select. |
barBackgroundColor | string | Specifies the taskbar background fill color globally. |
barBackgroundSelectedColor | string | Specifies the taskbar background fill color globally on select. |
arrowColor | string | Specifies the relationship arrow fill color. |
arrowIndent | number | Specifies the relationship arrow right indent. Sets in px |
todayColor | string | Specifies the current period column fill color. |
TooltipContent | Specifies the Tooltip view for selected taskbar. | |
TaskListHeader | Specifies the task list Header view | |
TaskListTable | Specifies the task list Table view |
- TooltipContent:
React.FC<{ task: Task; fontSize: string; fontFamily: string; }>;
- TaskListHeader:
React.FC<{ headerHeight: number; rowWidth: string; fontFamily: string; fontSize: string;}>;
- TaskListTable:
React.FC<{ rowHeight: number; rowWidth: string; fontFamily: string; fontSize: string; locale: string; tasks: Task[]; selectedTaskId: string; setSelectedTask: (taskId: string) => void; }>;
Task
Parameter Name | Type | Description |
---|---|---|
id* | string | Task id. |
name* | string | Task display name. |
type* | string | Task display type: task, milestone, project |
start* | Date | Task start date. |
end* | Date | Task end date. |
progress* | number | Task progress. Sets in percent from 0 to 100. |
dependencies | string[] | Specifies the parent dependencies ids. |
styles | object | Specifies the taskbar styling settings locally. Object is passed with the following attributes: |
- backgroundColor: String. Specifies the taskbar background fill color locally. | ||
- backgroundSelectedColor: String. Specifies the taskbar background fill color locally on select. | ||
- progressColor: String. Specifies the taskbar progress fill color locally. | ||
- progressSelectedColor: String. Specifies the taskbar progress fill color globally on select. | ||
isDisabled | bool | Disables all action for current task. |
fontSize | string | Specifies the taskbar font size locally. |
project | string | Task project name |
hideChildren | bool | Hide children items. Parameter works with project type only |
*Required
License
Top Related Projects
GPL version of Javascript Gantt Chart
Gantt Gantt Gantt Timeline Schedule Calendar [ javascript gantt, js gantt, projects gantt, timeline, scheduler, gantt timeline, reservation timeline, react gantt, angular gantt, vue gantt, svelte gantt, booking manager ]
🍞📅A JavaScript calendar that has everything you need.
A datepicker for twitter bootstrap (@twbs)
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot