Gantt API
import { Gantt } from '@editora/ui-react';
Props
| Prop | Type | Description |
|---|---|---|
autoSummary | boolean | A parent's dates follow its children (the earliest start to the latest end), and so does its progress when it has none of its own. |
barVariant | GanttBarVariant | |
cascade | boolean | Moving a parent moves everything under it by the same days (a read-only task stays put). Makes parent bars draggable. |
columns | GanttColumn[] | The task list's columns, in order. The name column is always first. Default: name, owner, dates, progress. |
creatable | boolean | Show a "+ Add task" button and let a double-click on empty timeline space ask for a task (onTaskCreate). Off in a readonly chart. |
criticalPath | boolean | Mark the critical path from the links: the tasks with no slack on a tight chain of links (a task you flag critical stays). |
fill | boolean | Fill the height of the container (which must have one): the toolbar keeps its height and the chart scrolls inside the rest. |
filterText | string | |
gridWidth | number | Width of the task list in px. The user can also drag the splitter; see onGridResize. |
headless | boolean | |
holidays | Array<string | Date | { date: string | Date; label?: string }> | Dates that are not working days: 'YYYY-MM-DD' strings, Dates, or { date, label }. Shaded apart from nonWorkingDays, and the label names them in the day header. |
initialScroll | 'today' | 'start' | Where the chart opens: on 'today' (the default, when today is not on the first screen) or at the 'start'. |
labels | Partial<GanttLabels> | Translations: any subset of the labels. |
linkable | boolean | Show a dot beside each bar that you can drag onto another bar to ask for a dependency (onLinkCreate). Off in a readonly chart. |
links | GanttLink[] | |
locale | string | BCP 47 locale for dates (month names, date formats, the week's first day). Defaults to the browser's. |
maxHeight | number | string | Cap on the chart's height when it is not fill: a number (px) or a plain CSS length ('60vh', 'none'). Default 620px. |
nonWorkingDays | number[] | 'weekend' | Weekdays that are not working days (0 is Sunday), or 'weekend' for Saturday and Sunday. Shaded behind the rows where a day is wide enough to read. |
onBeforeTaskChange | (detail: GanttBeforeTaskChangeDetail, event: CustomEvent<GanttBeforeTaskChangeDetail>) => void | Fired before a drag, resize or key changes dates. Call event.preventDefault() to refuse the change: nothing moves and onTaskChange does not fire. |
onFilterChange | (detail: { filter: string }, event: CustomEvent<{ filter: string }>) => void | |
onGridResize | (detail: { width: number }, event: CustomEvent<{ width: number }>) => void | |
onLinkCreate | (detail: GanttLinkCreateDetail, event: CustomEvent<GanttLinkCreateDetail>) => void | Fired when a link is dropped on another task: the dot it started from (the source's start or end) and the half of the target it landed on give the type. The host adds the link. |
onLinkDelete | (detail: GanttLinkSelectDetail, event: CustomEvent<GanttLinkSelectDetail>) => void | Fired when Delete or Backspace is pressed on a selected link (click a link to select it). The host removes it. |
onLinkSelect | (detail: GanttLinkSelectDetail, event: CustomEvent<GanttLinkSelectDetail>) => void | |
onSortChange | (detail: { sort: GanttSort }, event: CustomEvent<{ sort: GanttSort }>) => void | |
onTaskChange | (detail: GanttTaskChangeDetail, event: CustomEvent<GanttTaskChangeDetail>) => void | |
onTaskCreate | (detail: GanttTaskCreateDetail, event: CustomEvent<GanttTaskCreateDetail>) => void | Fired when the user asks for a new task (the Add button, or a double-click on empty timeline space). The host adds it. |
onTaskDelete | (detail: { id: string }, event: CustomEvent<{ id: string }>) => void | |
onTaskRename | (detail: GanttTaskRenameDetail, event: CustomEvent<GanttTaskRenameDetail>) => void | Fired when a name is edited in place (double-click it, or F2). Call event.preventDefault() to refuse. The component only keeps the new name until tasks is written again. |
onTaskSelect | (detail: { id: string }, event: CustomEvent<{ id: string }>) => void | |
onTaskToggle | (detail: { id: string; open: boolean }, event: CustomEvent<{ id: string; open: boolean }>) => void | |
onZoomChange | (detail: { zoom: GanttZoom }, event: CustomEvent<{ zoom: GanttZoom }>) => void | |
readonly | boolean | |
schedule | 'warn' | 'auto' | 'off' | How dependencies are enforced: 'warn' (the default) draws a link whose target is too early in the danger style, 'auto' also pushes the tasks that follow a task that moves (later only, keeping their length), 'off' does neither. |
showToday | boolean | |
showToolbar | boolean | |
snap | 'day' | 'week' | 'month' | How far a drag snaps: to whole 'day's (the default), 'week's or 'month's. Arrow keys still move a day at a time. |
sort | GanttSort | |
tasks | GanttTask[] | |
variant | 'default' | 'contrast' | |
virtualized | boolean | |
weekStart | 0 | 1 | 2 | 3 | 4 | 5 | 6 | First day of the week in the time header, as Date#getDay numbers it (0 is Sunday). Defaults to the locale's. |
zoom | GanttZoom |
Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).
Element: <ui-gantt>
Gantt renders the ui-gantt custom element from @editora/ui-core, which can also be used without React.
Attributes: auto-summary, bar-variant, cascade, columns, creatable, critical-path, fill, filter, grid-width, headless, holidays, labels, linkable, links, locale, max-height, non-working-days, readonly, schedule, show-today, show-toolbar, snap, sort, tasks, variant, week-start, zoom
Events: beforetaskchange, filterchange, gridresize, linkcreate, linkdelete, linkselect, sortchange, taskchange, taskcreate, taskdelete, taskrename, taskselect, tasktoggle, zoomchange