DocsGitHub
Getting Started
  • Overview
  • Design Tokens
Components
  • Accordion
  • Alert
  • Announcement
  • Avatar
  • Badge
  • BigCalendar
  • Breadcrumb
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Checkbox
  • Chip
  • CloseButton
  • Combobox
  • CommandPalette
  • ContextMenu
  • Currency
  • DatePicker
  • DescriptionList
  • Drawer
  • DropdownMenu
  • EmptyState
  • Field
  • FileUpload
  • FormGrid
  • GanttChart
  • Hotkey
  • Icon
  • Input
  • Kanban
  • Metric
  • Modal
  • MultiSelect
  • NumberInput
  • Pagination
  • Popover
  • ProgressBar
  • Radio
  • Rating
  • SegmentedControl
  • Select
  • SelectionCard
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Stepper
  • Switch
  • Table
  • Tabs
  • Textarea
  • Timeline
  • TimePicker
  • Toast
  • Tooltip
  • TransferList
  • TreeView
  • Wizard
Charts
  • Overview
  • Area Chart
  • Bar Chart
  • Donut Chart
  • Line Chart
  • Pie Chart
  • Stacked Bar Chart

GanttChart

Plan hierarchical work across day, week, and month scales with progress, milestones, dependencies, controlled state, and accessible pointer and keyboard editing.

Project plan

Groups organize related work, progress fills show completion, dependency lines communicate sequencing, and milestones mark fixed delivery dates.

Jul 13 – Sep 6, 2026
TaskOwnerStatusProgress
Jul 2026Aug 2026Sep 2026
Jul 13 – Jul 19Jul 20 – Jul 26Jul 27 – Aug 2Aug 3 – Aug 9Aug 10 – Aug 16Aug 17 – Aug 23Aug 24 – Aug 30Aug 31 – Sep 6
MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS
Today
—Done100%
—In progress42%
MayaIn progress60%
OmarIn progress40%
NoorIn progress25%
OmarBlocked0%
NoorTo do0%
—To do0%
Press Alt plus Left or Right Arrow to move. Press Alt plus Shift plus Left or Right Arrow to resize the end. Press Alt plus Control plus Left or Right Arrow to resize the start.
tsx
import { GanttChart, type GanttTask } from "madagent";

<GanttChart
  defaultTasks={tasks}
  defaultScale="week"
  defaultViewStart={new Date(2026, 6, 13)}
  defaultCollapsedTaskIds={["planning"]}
  today={new Date(2026, 6, 14)}
  aria-label="Product launch plan"
/>

Installation

tsx
import { GanttChart, type GanttTask, type GanttScale } from "madagent";

Day, week, and month scales

Control the scale, visible start date, and selected task independently. The chart also supports defaultScale, defaultViewStart, and defaultSelectedTaskId for uncontrolled use.

View starts Jul 13, 2026

Jul 13 – Sep 6, 2026
TaskOwnerStatusProgress
Jul 2026Aug 2026Sep 2026
Jul 13 – Jul 19Jul 20 – Jul 26Jul 27 – Aug 2Aug 3 – Aug 9Aug 10 – Aug 16Aug 17 – Aug 23Aug 24 – Aug 30Aug 31 – Sep 6
MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS
Today
—Done100%
MayaDone100%
OmarDone100%
—In progress42%
MayaIn progress60%
OmarIn progress40%
NoorIn progress25%
OmarBlocked0%
NoorTo do0%
—To do0%
Press Alt plus Left or Right Arrow to move. Press Alt plus Shift plus Left or Right Arrow to resize the end. Press Alt plus Control plus Left or Right Arrow to resize the start.

Design system selected

tsx
const [scale, setScale] = useState<GanttScale>("week");
const [viewStart, setViewStart] = useState(new Date(2026, 6, 13));
const [selectedTaskId, setSelectedTaskId] = useState<string | null>("design");

<GanttChart
  defaultTasks={tasks}
  scale={scale}
  onScaleChange={setScale}
  viewStart={viewStart}
  onViewStartChange={setViewStart}
  selectedTaskId={selectedTaskId}
  onSelectedTaskIdChange={setSelectedTaskId}
  aria-label="Controlled product launch timeline"
/>

Pointer and keyboard editing

Task changes are immutable and work in controlled or uncontrolled mode. onTaskChange also identifies whether the task moved or which edge was resized.

Drag a task or milestone bar to move it. Task bars also expose edge handles for resizing; groups cannot be moved or resized. On the focused task name, Alt + ←/→ moves the task or milestone by one scale step. Focus a named task resize handle and press←/→ to adjust that edge. In RTL, the arrows follow logical time direction. Press Esc during a pointer edit to cancel it.

Jul 13 – Sep 6, 2026
TaskOwnerStatusProgress
Jul 2026Aug 2026Sep 2026
Jul 13 – Jul 19Jul 20 – Jul 26Jul 27 – Aug 2Aug 3 – Aug 9Aug 10 – Aug 16Aug 17 – Aug 23Aug 24 – Aug 30Aug 31 – Sep 6
MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS
Today
—Done100%
MayaDone100%
OmarDone100%
—In progress42%
MayaIn progress60%
OmarIn progress40%
NoorIn progress25%
OmarBlocked0%
NoorTo do0%
—To do0%
Press Alt plus Left or Right Arrow to move. Press Alt plus Shift plus Left or Right Arrow to resize the end. Press Alt plus Control plus Left or Right Arrow to resize the start.

No task edits yet

tsx
const [tasks, setTasks] = useState<GanttTask[]>(initialTasks);

<GanttChart
  tasks={tasks}
  onTasksChange={setTasks}
  onTaskChange={(task, previousTask, reason) => {
    console.log({ task, previousTask, reason });
  }}
  editable
  aria-label="Editable project timeline"
/>

Read-only, disabled, and empty

Use readOnly to preserve exploration without edits, disabled to suspend the complete interaction surface, and an empty array when no scheduled work exists. Individual tasks can also be disabled.

Read-only

Navigation, group disclosure, and selection remain available; dates cannot be edited.

Jul 13 – Sep 6, 2026
TaskOwnerStatusProgress
Jul 2026Aug 2026Sep 2026
Jul 13 – Jul 19Jul 20 – Jul 26Jul 27 – Aug 2Aug 3 – Aug 9Aug 10 – Aug 16Aug 17 – Aug 23Aug 24 – Aug 30Aug 31 – Sep 6
MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS
Today
—Done100%
MayaDone100%
OmarDone100%
—In progress42%
MayaIn progress60%
OmarIn progress40%
Press Alt plus Left or Right Arrow to move. Press Alt plus Shift plus Left or Right Arrow to resize the end. Press Alt plus Control plus Left or Right Arrow to resize the start.

Disabled

Every chart control and task interaction is unavailable.

Jul 13 – Sep 6, 2026
TaskOwnerStatusProgress
Jul 2026Aug 2026Sep 2026
Jul 13 – Jul 19Jul 20 – Jul 26Jul 27 – Aug 2Aug 3 – Aug 9Aug 10 – Aug 16Aug 17 – Aug 23Aug 24 – Aug 30Aug 31 – Sep 6
MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS
Today
—Done100%
MayaDone100%
OmarDone100%
—In progress42%
MayaIn progress60%
OmarIn progress40%
Press Alt plus Left or Right Arrow to move. Press Alt plus Shift plus Left or Right Arrow to resize the end. Press Alt plus Control plus Left or Right Arrow to resize the start.

Empty

An empty task collection keeps the timeline usable and shows an accessible empty-state row.

Jul 13 – Sep 6, 2026
TaskOwnerStatusProgress
Jul 2026Aug 2026Sep 2026
Jul 13 – Jul 19Jul 20 – Jul 26Jul 27 – Aug 2Aug 3 – Aug 9Aug 10 – Aug 16Aug 17 – Aug 23Aug 24 – Aug 30Aug 31 – Sep 6
MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS
Today
No tasks
Add tasks to start planning this schedule.
Press Alt plus Left or Right Arrow to move. Press Alt plus Shift plus Left or Right Arrow to resize the end. Press Alt plus Control plus Left or Right Arrow to resize the start.
tsx
<GanttChart tasks={tasks} readOnly aria-label="Read-only project timeline" />
<GanttChart tasks={tasks} disabled aria-label="Disabled project timeline" />
<GanttChart tasks={[]} aria-label="Empty project timeline" />

GanttChart Props

PropTypeDefaultDescription
tasks
readonly GanttTask[]
-Controlled task collection
defaultTasks
readonly GanttTask[]
[]Initial task collection for uncontrolled mode
onTasksChange
(tasks: GanttTask[]) => void
-Receives a new immutable task array after an edit
onTaskChange
(task: GanttTask, previousTask: GanttTask, reason: GanttTaskChangeReason) => void
-Reports the edited task, its previous value, and a "move", "resize-start", or "resize-end" reason
scale
GanttScale
-Controlled timeline scale: day, week, or month
defaultScale
GanttScale
"week"Initial scale for uncontrolled mode
onScaleChange
(scale: GanttScale) => void
-Called when the timeline scale changes
viewStart
Date
-Controlled first visible calendar date
defaultViewStart
Date
-Initial first visible date, aligned to the initial scale boundary; defaults near the earliest task or today
onViewStartChange
(date: Date) => void
-Called when navigation or a scale change updates the first visible date
onNavigate
(direction: "previous" | "next" | "today", viewStart: Date) => void
-Reports toolbar navigation and its resolved start date
selectedTaskId
stringnull
-Controlled selected task id
defaultSelectedTaskId
stringnull
nullInitial selected task id for uncontrolled mode
onSelectedTaskIdChange
(taskId: string | null) => void
-Called when selection changes
onTaskSelect
(task: GanttTask | null) => void
-Reports the selected task object or a cleared selection
collapsedTaskIds
readonly string[]
-Controlled collapsed group ids
defaultCollapsedTaskIds
readonly string[]
[]Initial collapsed group ids for uncontrolled mode
onCollapsedTaskIdsChange
(taskIds: string[]) => void
-Called when a group is expanded or collapsed
locale
string
"en-US"Locale passed to Intl.DateTimeFormat
today
Date
-Deterministic "today" override used by the marker, implicit initial viewport, and Today navigation
editable
boolean
trueEnables pointer and keyboard task editing
readOnly
boolean
falsePrevents edits while retaining navigation and selection
disabled
boolean
falseDisables all controls and task interactions
taskRailWidth
number
430Width of the sticky task rail in CSS pixels, clamped to at least 240
rowHeight
number
58Fixed task row height in CSS pixels, clamped to at least 44
aria-label
string
"Project schedule"Accessible name for the chart
...divProps
Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "onSelect">
-Native div attributes except onChange/onSelect, plus a forwarded ref

GanttTask

Task dates are calendar dates. The end date is inclusive, groups can own nested tasks through parentId, and dependencies refer to predecessor ids.

Empty ids, invalid dates, and later duplicate ids are omitted. A reversed range is normalized to its start date, milestone end dates are normalized to their start date, progress is clamped to 0–100, and an omitted color is derived from status.

PropTypeDefaultDescription
id*
string
-Stable identifier used by selection, hierarchy, and dependencies
title*
string
-Human-readable task name
start*
Date
-Start calendar date; time-of-day is ignored
end*
Date
-Inclusive end date; milestones render on one date
progress
number
0Completion percentage, clamped to the 0–100 range for rendering
type
"task""group""milestone"
"task"Visual and behavioral task kind
status
"todo""in-progress""done""blocked"
-Semantic workflow state and default color source
color
"accent""info""positive""warning""negative""chart1""chart2""chart3""chart4""chart5"
-Semantic or chart-token bar color
assignee
ReactNode
-Owner content, such as a name or Avatar
parentId
string
-Parent group or task id; orphan tasks safely render at the root
dependencies
string[]
[]Predecessor task ids used to draw dependency connectors
disabled
boolean
falsePrevents editing and selection while leaving the task readable

Accessibility

Always give the chart a concise aria-label. The task rail and timeline expose a named treegrid with native focusable controls, groups communicate their expanded state and hierarchy, and selection does not rely on color alone.

  • Tab reaches chart navigation, scale, disclosure, task, and edit controls; visible rows expose their hierarchy through the treegrid.
  • Enter or Space selects the focused task name; selecting the current item again clears selection.
  • The task-name controls use roving focus: Up/Down moves through visible tasks, Home/End jumps to a boundary, logical inline-end expands a group or enters its first child, and logical inline-start collapses a group or returns to its parent.
  • Alt + Left/Right moves the focused editable task name. A focused, named resize separator uses Left/Right without a modifier. Each step is 1 day, 7 days, or 30 days for day, week, or month scale. Groups are not movable, and groups and milestones have no resize handles.
  • Completed move and resize operations are announced through a polite live region and emit the same callbacks as pointer edits. Escape or pointer cancellation aborts an active pointer preview without callbacks.
  • readOnly preserves navigation and selection, whiledisabled disables controls and task interactions; the scrollable timeline region remains reachable for reading.

RTL Support

Components automatically adapt to right-to-left languages using CSS logical properties.

Preview

١٣ يوليو – ٦ سبتمبر ٢٠٢٦
المهمةالمسؤولالحالةالتقدّم
يوليو ٢٠٢٦أغسطس ٢٠٢٦سبتمبر ٢٠٢٦
١٣ يوليو – ١٩ يوليو٢٠ يوليو – ٢٦ يوليو٢٧ يوليو – ٢ أغسطس٣ أغسطس – ٩ أغسطس١٠ أغسطس – ١٦ أغسطس١٧ أغسطس – ٢٣ أغسطس٢٤ أغسطس – ٣٠ أغسطس٣١ أغسطس – ٦ سبتمبر
نثرخجسحنثرخجسحنثرخجسحنثرخجسحنثرخجسحنثرخجسحنثرخجسحنثرخجسح
اليوم
—مكتمل100%
ليانمكتمل100%
عمرقيد التنفيذ65%
—للتنفيذ0%
يمكن النقل بالضغط على Alt مع السهم الأيمن أو الأيسر، وتغيير تاريخ النهاية بالضغط على Alt مع Shift والسهم الأيمن أو الأيسر، وتغيير تاريخ البداية بالضغط على Alt مع Control والسهم الأيمن أو الأيسر.

Usage

tsx
<GanttChart
  defaultTasks={arabicTasks}
  locale="ar-EG"
  defaultScale="week"
  aria-label="خطة إطلاق المنتج"
/>