# Gantt

> Project schedules with a Data Grid task pane and a timeline chart, auto scheduling on working calendars, dependencies with lag, critical path, baselines, milestones, split tasks, resources, taskbar editing, undo, export and the GanttApi.

Canonical: https://salmonui.dev/docs/calendars/gantt

```tsx
import { Gantt } from '@salmonui/gantt';
import '@salmonui/gantt/styles.css';

<Gantt
  data={tasks}
  taskFields={{ parentId: 'parentId' }}
  timeZone="Europe/Berlin"
  height={520}
  toolbar={['add', 'edit', 'delete', 'zoomIn', 'zoomOut', 'zoomToFit', 'criticalPath', 'undo', 'redo']}
  undo
  onDataChange={(rows) => setTasks(rows)}
/>;
```

`@salmonui/gantt/styles.css` carries the rules of everything the Gantt
renders (the Data Grid pane, the Splitter, the task editor's Dialog and
DatePicker, and the menus), so it is the only stylesheet besides
`@salmonui/core/styles.css`; only the lazy taskbar tooltip needs
`@salmonui/overlays/tooltip/styles.css` ([Tooltips](https://salmonui.dev/docs/calendars/gantt#tooltips)).

## Composition and state model

The left pane is `DataGrid` in tree mode, composed only through the public
Data Grid extension points (`api.getVisibleRows()`, `api.getViewport()`,
`api.subscribeViewport()`, `api.scrollTo()` and `api.getRowOffsets()`), so
sorting, filtering, search, selection, column menu, reorder, resize, pinning,
hiding, templates, grid lines, tree expansion, row drag and the empty view keep
their Data Grid names, events and budgets. Pass those props to `Gantt`
unchanged. The chart pane draws exactly the rows of the grid's visible row
model in the grid's rendered window: a grid scroll moves the chart rows with one
transform write, and the vertical wheel over the chart scrolls the grid. The
chart timeline follows the grid header's height (a filter bar makes it taller)
and chart rows follow the grid's horizontal `gridLines`. `treeFilterMode`
(`'ancestors'`, `'descendants'`, `'both'`, `'none'`, the Data Grid
`tree.filterMode`) picks the rows a filter or search keeps around the matches.
A row drag drop (`rowDrag`) and `api.moveRows(ids, { targetRowId, position })`
move the tasks through the engine, which reschedules them. `data` can also be a
Data Grid source (`createControlledDataSource`) or use lazy children
(`hasChildrenField`, `loadChildren`): the rows the grid loads join the
schedule and the chart. A new array is applied in place, but an array and a
source are different data modes: give the `Gantt` a new `key` to switch
between them.

### Remote data and writes

A source with `write` (`createControlledDataSource({ onQueryChange,
onDataChange })` or any `@salmonui/data` source) receives every committed
change, from the taskbar, the dialog, a grid edit or the API, as one Data Grid
`WriteRequest` through the grid's data source: `changed` rows carry the
computed dates (`start`, `end`, `duration`, `progress` as `Date` instants and
numbers) and the row's own parent field, `added` and `deleted` the inserted
and removed tasks, `mode: 'batch'`, and a `signal`. The rows the change
touched, the task and the dependents it rescheduled, are pending
(`data-pending` on their chart rows) until the write settles; on success the
grid pane shows the written rows. A newer change of the same task aborts the
older request (its tasks join the newer one) and unmounting aborts every
write in flight. A rejected Promise or a `status: 'rejected'` result reverts
the change in both panes and calls `onError({ error, action, taskIds })`.
Until a task is written the grid pane shows the source's own fields (a task
scheduled from its predecessors has no `end` there yet); the chart shows the
computed schedule.

```tsx
const source = createControlledDataSource({
  onQueryChange: (request) => api.readTasks(request),
  onDataChange: (request) => api.saveTasks(request, { signal: request.signal }),
});

<Gantt data={source} taskFields={{ parentId: 'parentId' }} timeZone="UTC" onError={(e) => toast(String(e.error))} />;
```

### Loading placeholders

`loadingIndicator: 'skeleton'` (the Data Grid prop) shows
the grid's skeleton rows while the source loads, after `api.refresh()` and
under `api.setLoading(true)`; the chart pane shows the same skeleton rows at
the same height. Under a lazy parent whose children load, the grid opens a
skeleton row (`virtualization.skeletonRows`, default on) and the chart opens the same gap with a shimmer bar
under the parent's bar, so both panes stay aligned; `virtualization:
{ skeletonRows: false }` turns both off. The default `'spinner'` covers the
grid pane only. The placeholders are client-only and add no CSS.

`Gantt` follows the Data Grid model: options props (`data`, `workingTime`,
`criticalPath`, `zoom`, `timeline`, ...) are re-applied when they change; user
actions fire before and after events that cancel with `preventDefault()`
(`onBeforeTaskChange` / `onTaskChange`, `onBeforeDependencyChange` /
`onDependencyChange`, `onBeforeTaskbarEditEnd` / `onTaskbarEditEnd`,
`onBeforeDialogOpen`, `onBeforeExport` / `onExport`); `ref` receives the
`GanttApi`, which extends the grid pane's `DataGridApi`. `onDataChange(rows)`
gives the changed data in the shape you passed (nested or flat); passing that
array back as `data` is not a reload.

### Live demo: Gantt remote data

Live demo: https://salmonui.dev/demos/calendars/gantt-remote

Tasks from a controlled data source with skeleton rows while the first read is slow, writes that apply or are rejected and reverted, a local array that is replaced through the data prop and whose wave loads its children on expand, onViewChange and the loading spinner.

`Demo.tsx`:

```tsx
'use client';

import { useMemo, useRef, useState } from 'react';
import { createControlledDataSource } from '@salmonui/data';
import { Gantt, type GanttApi, type GanttProps } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Checkbox } from '@salmonui/inputs/checkbox';

type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; progress?: number; predecessors?: string; hasChildren?: boolean };

const SERVER: Task[] = [
  { id: 1, title: 'Data center migration', parentId: null },
  { id: 2, title: 'Inventory', parentId: 1, start: '2027-09-06', duration: 3, progress: 100 },
  { id: 3, title: 'Network cutover', parentId: 1, duration: 2, predecessors: '2FS' },
  { id: 4, title: 'Wave 1', parentId: null, start: '2027-09-13', duration: 5 },
];
const WAVE: Task[] = [
  { id: 41, title: 'Web servers', parentId: 4, start: '2027-09-13', duration: 2 },
  { id: 42, title: 'Databases', parentId: 4, duration: 3, predecessors: '41FS' },
];

// A local array whose wave loads its children on expand (hasChildrenField / loadChildren).
const LOCAL: Task[] = [
  { id: 100, title: 'Local plan', parentId: null },
  { id: 101, title: 'Offline task', parentId: 100, start: '2027-09-06', duration: 4 },
  { id: 4, title: 'Wave 1 (loads on expand)', parentId: null, start: '2027-09-13', duration: 5, hasChildren: true },
];

const wait = (ms: number, signal?: { addEventListener(type: 'abort', listener: () => void): void }) =>
  new Promise<void>((resolve, reject) => {
    const t = setTimeout(resolve, ms);
    signal?.addEventListener('abort', () => {
      clearTimeout(t);
      reject(new DOMException('Aborted', 'AbortError'));
    });
  });


const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['title', 'start', 'end', 'duration'];
/** A controlled data source with a slow first read and skeleton rows, children loaded on expand, writes that may be rejected, data replacement, onViewChange and the loading spinner. */
export default function GanttRemoteDemo() {
  const apiRef = useRef<GanttApi<Task>>(null);
  const reject = useRef(false);
  const [rejecting, setRejecting] = useState(false);
  const [local, setLocal] = useState(false);
  const [localRows, setLocalRows] = useState<readonly Task[]>(LOCAL);
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 8));
  const source = useMemo(
    () =>
      createControlledDataSource<Task>({
        onQueryChange: async (request) => {
          await wait(900, request.signal);
          return { version: request.version, rows: SERVER.map((r) => ({ ...r })), totalRowCount: SERVER.length };
        },
        onDataChange: async (request) => {
          await wait(600, request.signal);
          if (reject.current) return { version: request.version, status: 'rejected' as const };
          add(`write: ${request.changed.length} changed, ${request.added.length} added, ${request.deleted.length} deleted`);
          return { version: request.version, status: 'applied' as const, changed: request.changed.map((c) => ({ rowId: c.rowId, row: c.row })) };
        },
      }),
    [],
  );
  return (
    <div>
      <div className="demo-toolbar">
        <Checkbox
          checked={rejecting}
          onCheckedChange={(checked) => {
            reject.current = checked;
            setRejecting(checked);
          }}
        >
          Server rejects writes
        </Checkbox>
        <Button variant="outline" type="button" onClick={() => setLocal((l) => !l)}>
          {local ? 'Back to the server source' : 'Switch to a local array'}
        </Button>
        {local ? (
          <Button variant="outline" type="button" onClick={() => setLocalRows((rows) => [...rows, { id: 200 + rows.length, title: `Added task ${rows.length - 2}`, parentId: 100, start: '2027-09-08', duration: 2 }])}>
            Replace the array (one more task)
          </Button>
        ) : null}
        <Button variant="outline" type="button" onClick={() => apiRef.current?.refresh()}>
          Reload (refresh)
        </Button>
        <Button variant="outline"
          type="button"
          onClick={() => {
            apiRef.current?.setLoading(true);
            setTimeout(() => apiRef.current?.setLoading(false), 1200);
          }}
        >
          setLoading for 1.2 s
        </Button>
      </div>
      <Gantt<Task>
        // A source and an array are different data modes: switching remounts; a new array is reactive.
        key={local ? 'local' : 'remote'}
        ref={apiRef}
        aria-label="Data center migration from a server"
        data={local ? localRows : source}
        onDataChange={(rows) => local && setLocalRows(rows)}
        taskFields={{ parentId: 'parentId' }}
        columns={COLUMNS}
        hasChildrenField="hasChildren"
        loadChildren={async ({ rowId, signal }) => {
          add(`loadChildren(${String(rowId)})`);
          await wait(700, signal);
          return WAVE.map((r) => ({ ...r }));
        }}
        loadingIndicator="skeleton"
        timeZone="UTC"
        locale="en-GB"
        height={360}
        onViewChange={() => add('onViewChange')}
        onError={(e) => add(`onError(${e.action}) for [${e.taskIds.join(', ')}]: reverted`)}
      />
      <div className="demo-log" aria-live="polite">
        <ol>{log.length ? log.map((line, i) => <li key={`${i}-${line}`}>{line}</li>) : <li>Loading from the server…</li>}</ol>
      </div>
    </div>
  );
}
```

## Tasks and fields

`data` holds nested rows (`children`) or flat rows with a parent id.
`taskFields` maps the roles to your property names: `id`, `title`, `start`,
`end`, `duration`, `durationUnit`, `progress`, `parentId`, `children`,
`predecessors`, `milestone`, `notes`, `baselineStart`, `baselineEnd`,
`baselineDuration`, `resources`, `work`, `taskType`, `manual`, `segments`,
`indicators`, `expanded`, `constraintType`, `constraintDate`, `calendar` and
`className`. Dates are `Date`s, ISO strings, epoch ms or plain
`{ year, month, day, hour, minute }` objects, read as wall times in
`timeZone`. Set `timeZone` for server rendering.

## Scheduling

The project engine derives the missing value of start, end and duration on
working time (`autoSchedule`, default `true`). `workingTime` sets the day
ranges, per-weekday ranges, work days, `includeWeekend`, `hoursPerDay`,
`daysPerWeek` and `daysPerMonth`; `holidays` are non-working and shaded;
`calendars` with `projectCalendar` and the task `calendar` role give named
calendars with exceptions. `taskMode` is `'auto'`, `'manual'` or `'custom'`
(per task `manual`); manual parents keep their dates and show the rolled-up
range. Parents roll up dates and duration-weighted progress. `taskType`
(`'fixedUnit'`, `'fixedWork'`, `'fixedDuration'`) and `workUnit` drive the
work math; `api.formatWork(id)` and `api.formatDuration(id)` format them.
Constraints are the eight Project types with `constraintDate`;
`unscheduledTasks` renders tasks without dates as placeholders.

Dependencies use the string form (`'2FS+3d,3SS-2h'`) or
`{ id, type: 'fs' | 'ss' | 'ff' | 'sf', lag, lagUnit }[]`.
`dependencyTypes` limits the types, `parentDependencies` allows links on
parents, `validateManualTasks` validates manual successors and
`dependencyLag` normalizes lags on load or on taskbar edits. With
`validateDependencies` (default) a user edit that breaks a link opens the
conflict dialog (keep the link and move the task, remove the link, or cancel),
or calls `onScheduleConflict(event)` with `event.resolve(choice)`.

`criticalPath` marks critical bars and connectors (`data-critical`);
`api.getCriticalTasks()` and the total float in `api.getTaskInfo(id)` come from
a forward and backward pass. `wbs` adds the `'wbs'` and `'wbsPredecessors'`
column presets. `projectStart` / `projectEnd` and `api.setProjectDates()` set
the project range.

### Live demo: Gantt scheduling and dependencies

Live demo: https://salmonui.dev/demos/calendars/gantt-scheduling

A warehouse fit-out on mapped fields with finish-to-start, start-to-start and finish-to-finish links with lags, the critical path and total float, auto and manual task modes, a constraint, an unscheduled task, the conflict dialog, project dates, durations, WBS codes and serial numbers.

`Demo.tsx`:

```tsx
'use client';

import { useRef, useState } from 'react';
import { Gantt, type GanttApi, type GanttProps, type GanttTaskMode } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Checkbox } from '@salmonui/inputs/checkbox';
import { Select } from '@salmonui/dropdowns/select';

// Your own property names, mapped through taskFields.
type Task = {
  TaskID: number;
  Name: string;
  Parent: number | null;
  Begin?: string;
  Days?: number;
  Done?: number;
  Deps?: string;
  Manual?: boolean;
  Constraint?: string;
  ConstraintOn?: string;
};

const tasks: Task[] = [
  { TaskID: 1, Name: 'Warehouse fit-out', Parent: null },
  { TaskID: 2, Name: 'Permits', Parent: 1, Begin: '2027-04-05', Days: 5, Done: 100 },
  { TaskID: 3, Name: 'Demolition', Parent: 1, Days: 3, Done: 40, Deps: '2FS' },
  { TaskID: 4, Name: 'Electrical', Parent: 1, Days: 6, Deps: '3FS+2d' },
  { TaskID: 5, Name: 'Plumbing', Parent: 1, Days: 4, Deps: '3SS+1d' },
  { TaskID: 6, Name: 'Inspection (start no earlier than 26 Apr)', Parent: 1, Days: 1, Deps: '4FS,5FF', Constraint: 'startNoEarlierThan', ConstraintOn: '2027-04-26' },
  { TaskID: 7, Name: 'Racking (manual dates)', Parent: 1, Begin: '2027-04-19', Days: 3, Manual: true, Deps: '3FS' },
  { TaskID: 8, Name: 'Handover', Parent: 1, Days: 0, Deps: '6FS,7FS' },
  { TaskID: 9, Name: 'Signage (no dates yet)', Parent: 1 },
  { TaskID: 10, Name: 'Opening party (after the whole fit-out)', Parent: null, Days: 1, Deps: '1FS' },
];


const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['serialNumber', 'wbs', 'title', 'start', 'end', 'duration', 'progress', 'predecessors', 'wbsPredecessors'];
/** Dependency types and lags, the critical path and total float, task modes, auto scheduling, constraints, unscheduled tasks, conflict validation, project dates, durations, WBS and serial numbers on mapped fields. */
export default function GanttSchedulingDemo() {
  const apiRef = useRef<GanttApi<Task>>(null);
  const [data, setData] = useState<readonly Task[]>(tasks);
  const [critical, setCritical] = useState(true);
  const [auto, setAuto] = useState(true);
  const [mode, setMode] = useState<GanttTaskMode>('custom');
  const [validateManual, setValidateManual] = useState(false);
  const [askConflicts, setAskConflicts] = useState(true);
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((lines) => [line, ...lines].slice(0, 8));
  return (
    <div>
      <div className="demo-toolbar">
        <Checkbox checked={critical} onCheckedChange={(checked) => setCritical(checked)}>
          Critical path
        </Checkbox>
        <Checkbox checked={auto} onCheckedChange={(checked) => setAuto(checked)}>
          Auto schedule
        </Checkbox>
        <label>
          Task mode
          <Select aria-label="Task mode" data={[{ value: 'custom', label: 'custom (per-task Manual field)' }, { value: 'auto', label: 'auto' }, { value: 'manual', label: 'manual' }]} value={mode} onValueChange={(value) => value != null && setMode(value as GanttTaskMode)} />
        </label>
        <Checkbox checked={validateManual} onCheckedChange={(checked) => setValidateManual(checked)}>
          Validate manual successors
        </Checkbox>
        <Checkbox checked={askConflicts} onCheckedChange={(checked) => setAskConflicts(checked)}>
          Conflict dialog (else move the task)
        </Checkbox>
      </div>
      <div className="demo-toolbar">
        <Button variant="outline" type="button" onClick={() => add(`getCriticalTasks(): ${(apiRef.current?.getCriticalTasks() ?? []).map((t) => t.Name).join(', ')}`)}>
          getCriticalTasks()
        </Button>
        <Button variant="outline"
          type="button"
          onClick={() => {
            const i = apiRef.current?.getTaskInfo('5');
            add(i ? `getTaskInfo(5): ${i.start?.toISOString().slice(0, 10)} to ${i.end?.toISOString().slice(0, 10)}, float ${i.totalFloat} h, WBS ${i.wbs}, ${apiRef.current?.formatDuration('5')}` : 'no task');
          }}
        >
          getTaskInfo(5)
        </Button>
        <Button variant="outline" type="button" onClick={() => add(`setTaskMode(3, 'manual'): ${apiRef.current?.setTaskMode('3', 'manual').status}`)}>
          setTaskMode(3, manual)
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.setProjectDates('2027-03-29', '2027-05-28')}>
          setProjectDates
        </Button>
        <Button variant="outline" type="button" onClick={() => add(`updateTask(2, 8 days): ${apiRef.current?.updateTask('2', { Days: 8 }).status}`)}>
          Permits take 8 days
        </Button>
      </div>
      <Gantt<Task>
        ref={apiRef}
        aria-label="Warehouse fit-out schedule"
        data={data}
        taskFields={{ id: 'TaskID', title: 'Name', parentId: 'Parent', start: 'Begin', duration: 'Days', progress: 'Done', predecessors: 'Deps', manual: 'Manual', constraintType: 'Constraint', constraintDate: 'ConstraintOn' }}
        columns={COLUMNS}
        wbs={{ autoUpdate: true }}
        timeZone="UTC"
        locale="en-GB"
        projectStart="2027-04-05"
        height={500}
        criticalPath={critical}
        autoSchedule={auto}
        taskMode={mode}
        unscheduledTasks
        validateDependencies
        validateManualTasks={validateManual}
        parentDependencies
        dependencyLag={{ normalizeOnLoad: true, updateOnTaskbarEdit: true }}
        connectorWidth={2}
        onScheduleConflict={(e) => {
          add(`onScheduleConflict: ${e.conflicts.map((c) => (c.task ? c.task.Name : '?')).join(', ')}`);
          if (!askConflicts) e.resolve('move');
        }}
        onDataChange={(rows) => setData(rows)}
      />
      <div className="demo-log" aria-live="polite">
        <ol>{log.length ? log.map((line, i) => <li key={`${i}-${line}`}>{line}</li>) : <li>Drag a task before its predecessor or press a button</li>}</ol>
      </div>
    </div>
  );
}
```

### Live demo: Gantt calendars and working time

Live demo: https://salmonui.dev/demos/calendars/gantt-calendars

Office hours with a lunch break and a short Friday, Christmas and New Year holidays, shaded weekends, a night-shift and a seven-day calendar per task, a time zone switch, an hour-based duration and work, units and task types.

`Demo.tsx`:

```tsx
'use client';

import { useMemo, useRef, useState } from 'react';
import { Gantt, type GanttApi, type GanttProps, type GanttCalendar, type GanttTaskType, type GanttWorkingTime } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Checkbox } from '@salmonui/inputs/checkbox';
import { Select } from '@salmonui/dropdowns/select';

type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; durationUnit?: string; work?: number; taskType?: GanttTaskType; resources?: { id: string; unit: number }[]; calendar?: string };

const tasks: Task[] = [
  { id: 1, title: 'Plant upgrade', parentId: null },
  { id: 2, title: 'Order parts (office hours)', parentId: 1, start: '2027-12-20T09:00', duration: 3 },
  { id: 3, title: 'Night shift install (night calendar)', parentId: 1, start: '2027-12-21T20:00', duration: 2, calendar: 'night' },
  { id: 4, title: 'Commissioning (16 h of work, 2 people)', parentId: 1, start: '2027-12-27T09:00', work: 16, taskType: 'fixedWork', resources: [{ id: 'ana', unit: 100 }, { id: 'ben', unit: 100 }] },
  { id: 5, title: 'Weekend test run (7-day calendar)', parentId: 1, start: '2027-12-25T08:00', duration: 2, calendar: 'sevenDay' },
  { id: 6, title: 'Handover meeting (3 hours)', parentId: 1, start: '2028-01-03T10:00', duration: 3, durationUnit: 'hour' },
];

const people = [
  { id: 'ana', name: 'Ana' },
  { id: 'ben', name: 'Ben' },
];

const DATE_FORMAT: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' };
const HOLIDAYS = [
  { start: '2027-12-24', end: '2027-12-26', label: 'Christmas' },
  { start: '2028-01-01', label: 'New Year' },
];

const calendars: GanttCalendar[] = [
  { id: 'night', workingTime: { dayRanges: [{ from: 20, to: 24 }], workDays: [1, 2, 3, 4, 5] } },
  { id: 'sevenDay', workingTime: { includeWeekend: true }, exceptions: [{ start: '2027-12-31', ranges: [{ from: 8, to: 12 }] }] },
];


// Days over six-hour cells: the whole plan, its weekends and holidays fit in view, the working hours still show.
const TIMELINE: NonNullable<GanttProps<Task>['timeline']> = { topTier: { unit: 'day', format: { weekday: 'short', day: 'numeric', month: 'short' } }, bottomTier: { unit: 'hour', count: 6, format: { hour: '2-digit' } }, unitWidth: 24 };
const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['title', 'start', 'end', 'duration', 'work', 'taskType', 'resources'];
/** Working time with lunch breaks and a short Friday, holidays, weekend shading, named calendars per task, a time zone, hour-based durations and work-driven task types. */
export default function GanttCalendarsDemo() {
  const apiRef = useRef<GanttApi<Task>>(null);
  const [data, setData] = useState<readonly Task[]>(tasks);
  const [zone, setZone] = useState('Europe/Berlin');
  const [shortFriday, setShortFriday] = useState(true);
  const [type, setType] = useState<GanttTaskType>('fixedUnit');
  const [status, setStatus] = useState('');
  const workingTime: GanttWorkingTime = useMemo(
    () => ({
      dayRanges: [
        { from: 9, to: 12.5 },
        { from: 13.5, to: 18 },
      ],
      ...(shortFriday ? { week: { 5: [{ from: 9, to: 13 }] } } : {}),
      workDays: [1, 2, 3, 4, 5],
      hoursPerDay: 8,
    }),
    [shortFriday],
  );
  return (
    <div>
      <div className="demo-toolbar">
        <label>
          Time zone
          <Select aria-label="Time zone" data={[{ value: 'Europe/Berlin', label: 'Europe/Berlin' }, { value: 'America/Chicago', label: 'America/Chicago' }, { value: 'UTC', label: 'UTC' }]} value={zone} onValueChange={(value) => value != null && setZone(String(value))} />
        </label>
        <Checkbox checked={shortFriday} onCheckedChange={(checked) => setShortFriday(checked)}>
          Friday ends at 13:00
        </Checkbox>
        <label>
          Default task type
          <Select aria-label="Default task type" data={[{ value: 'fixedUnit', label: 'fixedUnit' }, { value: 'fixedWork', label: 'fixedWork' }, { value: 'fixedDuration', label: 'fixedDuration' }]} value={type} onValueChange={(value) => value != null && setType(value as GanttTaskType)} />
        </label>
        <Button variant="outline" type="button" onClick={() => setStatus(`Commissioning: ${apiRef.current?.formatDuration('4')}, ${apiRef.current?.formatWork('4')}; handover: ${apiRef.current?.formatDuration('6')}`)}>
          formatDuration / formatWork
        </Button>
      </div>
      <Gantt<Task>
        ref={apiRef}
        aria-label="Plant upgrade with calendars"
        data={data}
        taskFields={{ parentId: 'parentId' }}
        columns={COLUMNS}
        resources={people}
        timeZone={zone}
        locale="en-GB"
        workingTime={workingTime}
        holidays={HOLIDAYS}
        highlightWeekends
        calendars={calendars}
        workUnit="hour"
        taskType={type}
        timeline={TIMELINE}
        dateFormat={DATE_FORMAT}
        height={420}
        onDataChange={(rows) => setData(rows)}
      />
      <p className="demo-status" aria-live="polite">
        {status || 'Change a resource unit or the work of Commissioning to see the task type at work'}
      </p>
    </div>
  );
}
```

## Columns

`columns` takes Data Grid columns and the task presets `'title'`, `'start'`,
`'end'`, `'duration'`, `'progress'`, `'predecessors'`, `'resources'`,
`'work'`, `'taskType'`, `'notes'`, `'baselineStart'`, `'baselineEnd'`,
`'wbs'`, `'wbsPredecessors'`, `'serialNumber'` and `'id'`. Durations are
edited as text (`'3 days'`, `'2h'`, localized through `localeText`),
predecessors in the string form. `dateFormat` sets the date format: `Intl`
options or a skeleton (`'yMMMd'`) or style (`'short'`) format the columns,
labels and tooltips; a pattern (`'dd.MM.yyyy'`) formats the columns.
`treeColumn` picks the expander column.

### Live demo: Gantt task pane features

Live demo: https://salmonui.dev/demos/calendars/gantt-grid-pane

The Gantt task pane with the Data Grid's sorting, filtering, search, multi-row selection, column menu, reorder, resize, a pinned ID column, a column chooser with a hidden column, a cell template and row props, grid lines and hover, tree expansion, a switchable tree column, row drag and an empty view.

`Demo.tsx`:

```tsx
'use client';

import { useState } from 'react';
import { Gantt, type GanttProps } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Select } from '@salmonui/dropdowns/select';

type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; progress?: number; predecessors?: string; team?: string; priority?: 'Low' | 'Normal' | 'High' };

const tasks: Task[] = [
  { id: 1, title: 'Payments platform', parentId: null, team: 'Platform' },
  { id: 2, title: 'API design', parentId: 1, start: '2027-02-01', duration: 4, progress: 100, team: 'Platform', priority: 'High' },
  { id: 3, title: 'Card processing', parentId: 1, duration: 8, progress: 50, predecessors: '2FS', team: 'Payments', priority: 'High' },
  { id: 4, title: 'Refunds', parentId: 1, duration: 5, progress: 10, predecessors: '3SS+2d', team: 'Payments', priority: 'Normal' },
  { id: 5, title: 'Mobile', parentId: null, team: 'Apps' },
  { id: 6, title: 'Checkout screen', parentId: 5, start: '2027-02-08', duration: 6, progress: 30, team: 'Apps', priority: 'Normal' },
  { id: 7, title: 'Wallet integration', parentId: 5, duration: 4, predecessors: '6FS', team: 'Apps', priority: 'Low' },
  { id: 8, title: 'Saved cards', parentId: 5, duration: 3, predecessors: '7FS', team: 'Apps', priority: 'Low' },
];

const columns: NonNullable<GanttProps<Task>['columns']> = [
  { field: 'id', header: 'ID', width: 84, pinned: 'start' },
  'title',
  { field: 'team', header: 'Team', width: 110 },
  {
    field: 'priority',
    header: 'Priority',
    width: 100,
    renderCell: ({ value }) => (value ? <span className="demo-badge" data-tone={value === 'High' ? undefined : 'info'}>{String(value)}</span> : null),
  },
  'start',
  'end',
  'duration',
  { field: 'progress', header: 'Done', width: 80, hidden: true },
];

/** The task pane is a Data Grid: sorting, filtering, search, selection, column menu, reorder, resize, a pinned column, a column chooser, templates, grid lines, tree expansion, the tree column, row drag and the empty view. */
export default function GanttGridPaneDemo() {
  const [data, setData] = useState<readonly Task[]>(tasks);
  const [lines, setLines] = useState<'both' | 'horizontal' | 'none'>('both');
  const [treeColumn, setTreeColumn] = useState<'title' | 'team'>('title');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 6));
  return (
    <div>
      <div className="demo-toolbar">
        <label>
          Grid lines
          <Select aria-label="Grid lines" data={[{ value: 'both', label: 'both' }, { value: 'horizontal', label: 'horizontal' }, { value: 'none', label: 'none' }]} value={lines} onValueChange={(value) => value != null && setLines(value as 'both' | 'horizontal' | 'none')} />
        </label>
        <label>
          Tree column
          <Select aria-label="Tree column" data={[{ value: 'title', label: 'title' }, { value: 'team', label: 'team' }]} value={treeColumn} onValueChange={(value) => value != null && setTreeColumn(value as 'title' | 'team')} />
        </label>
        <Button variant="outline" type="button" onClick={() => setData([])}>
          Remove every task
        </Button>
        <Button variant="outline" type="button" onClick={() => setData(tasks)}>
          Restore tasks
        </Button>
      </div>
      <Gantt<Task>
        aria-label="Payments roadmap"
        data={data}
        taskFields={{ parentId: 'parentId' }}
        columns={columns}
        treeColumn={treeColumn}
        treeFilterMode="ancestors"
        defaultExpanded="all"
        timeZone="UTC"
        locale="en-GB"
        height={440}
        sorting
        filtering
        search
        toolbar={['search', 'expandAll', 'collapseAll']}
        selection={{ multiple: true }}
        columnMenu
        reorderable
        resizable
        columnChooser
        gridLines={lines}
        highlightOnHover
        getRowProps={(row) => (row.priority === 'High' ? { className: 'demo-row--flagged' } : undefined)}
        rowDrag
        renderEmpty={() => <p style={{ padding: 16 }}>No tasks yet. Press “Restore tasks”.</p>}
        onSortChange={(e) => add(`onSortChange ${e.sortBy.map((s) => `${s.field} ${s.direction}`).join(', ') || 'none'}`)}
        onFilterChange={() => add('onFilterChange')}
        onSearchChange={(e) => add(`onSearchChange "${e.text}"`)}
        onSelectionChange={(e) => add(`onSelectionChange [${e.rowIds.join(', ')}]`)}
        onColumnReorder={() => add('onColumnReorder')}
        onColumnResizeEnd={() => add('onColumnResizeEnd')}
        onColumnVisibilityChange={() => add('onColumnVisibilityChange')}
        onTreeToggle={(e) => add(`onTreeToggle ${String(e.rowId)} ${e.expanded ? 'expanded' : 'collapsed'}`)}
        onRowDrop={() => add('onRowDrop')}
        onDataChange={(rows) => setData(rows)}
      />
      <div className="demo-log" aria-live="polite">
        <ol>{log.length ? log.map((line, i) => <li key={`${i}-${line}`}>{line}</li>) : <li>Sort, filter, search or drag a row</li>}</ol>
      </div>
    </div>
  );
}
```

## Timeline

`timeline.mode` (`'hour'`, `'day'`, `'week'`, `'month'`, `'year'`) picks a
tier preset; `topTier` / `bottomTier` (`unit`, `count`, `format`, `render`),
`unitWidth`, `weekStart` and `renderCell` refine it. `zoom` / `onZoomChange`
index `zoomLevels` (built-in levels from half-years to five minutes);
`api.zoomIn()`, `api.zoomOut()`, `api.zoomToFit()`, Ctrl+wheel and the
toolbar items change it. Tier cells, shading, markers and connectors are
virtualized horizontally (taskbars are bounded by the row window); `timeline.infinite` and `api.extendTimeline()` extend the range.
`highlightWeekends`, `holidays` and `markers` shade and mark dates.

### Live demo: Gantt timeline and zoom

Live demo: https://salmonui.dev/demos/calendars/gantt-timeline

Hour to year timeline modes and custom month-over-fortnight tiers with a cell template, unit width and Monday week start, zoom in and out, zoom to fit, an infinite timeline, scroll to a date or task, event markers, the splitter and panes, and a pattern date format.

`Demo.tsx`:

```tsx
'use client';

import { useRef, useState } from 'react';
import { Gantt, type GanttApi, type GanttProps, type GanttTimeline } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Select } from '@salmonui/dropdowns/select';
import { Slider } from '@salmonui/inputs/slider';

type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; progress?: number; predecessors?: string };

const tasks: Task[] = [
  { id: 1, title: 'Mobile app 2.0', parentId: null },
  { id: 2, title: 'Research', parentId: 1, start: '2027-01-11', duration: 10, progress: 100 },
  { id: 3, title: 'Prototype', parentId: 1, duration: 15, progress: 40, predecessors: '2FS' },
  { id: 4, title: 'Beta', parentId: 1, duration: 30, predecessors: '3FS' },
  { id: 5, title: 'Store review', parentId: 1, duration: 5, predecessors: '4FS' },
  { id: 6, title: 'Release', parentId: 1, duration: 0, predecessors: '5FS' },
];

type Mode = NonNullable<GanttTimeline['mode']>;


const MODE_OPTIONS = [...(['hour', 'day', 'week', 'month', 'year'] as const).map((m) => ({ value: m, label: `mode: ${m}` })), { value: 'custom', label: 'custom tiers: month over fortnights' }];
const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['title', 'start', 'end', 'duration'];
/** Timeline modes and custom tiers, unit width and week start, a tier cell template, zoom and fit, an infinite timeline, scroll methods, event markers, the splitter and panes, and the date format. */
export default function GanttTimelineDemo() {
  const apiRef = useRef<GanttApi<Task>>(null);
  const [mode, setMode] = useState<Mode | 'custom'>('week');
  const [unitWidth, setUnitWidth] = useState(33);
  const [panes, setPanes] = useState<'both' | 'grid' | 'chart'>('both');
  const [zoom, setZoom] = useState<string>('');
  const [status, setStatus] = useState('');
  const timeline: GanttTimeline =
    mode === 'custom'
      ? {
          topTier: { unit: 'month', format: { month: 'short', year: 'numeric' } },
          bottomTier: { unit: 'week', count: 2, format: { day: 'numeric' }, render: ({ date, text }) => <span title={`Fortnight from ${date.toISOString().slice(0, 10)}`}>{`⇥ ${text}`}</span> },
          unitWidth,
          weekStart: 1,
          infinite: true,
        }
      : {
          mode,
          unitWidth,
          weekStart: 1,
          infinite: true,
          renderCell: ({ tier, text }) => (tier === 'top' ? <strong>{text}</strong> : text),
        };
  return (
    <div>
      <div className="demo-toolbar">
        <label>
          Timeline
          <Select aria-label="Timeline" data={MODE_OPTIONS} value={mode} onValueChange={(value) => value != null && setMode(value as Mode | 'custom')} />
        </label>
        <Slider label="Unit width" min={20} max={80} value={unitWidth} onValueChange={setUnitWidth} valueLabel={{ format: (v) => `${String(v)} px` }} style={{ inlineSize: 160 }} />
        <label>
          Panes
          <Select aria-label="Panes" data={[{ value: 'both', label: 'both' }, { value: 'grid', label: 'grid' }, { value: 'chart', label: 'chart' }]} value={panes} onValueChange={(value) => value != null && setPanes(value as 'both' | 'grid' | 'chart')} />
        </label>
      </div>
      <div className="demo-toolbar">
        <Button variant="outline" type="button" onClick={() => apiRef.current?.zoomIn()}>
          zoomIn()
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.zoomOut()}>
          zoomOut()
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.zoomToFit()}>
          zoomToFit()
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.scrollToDate('2027-03-15')}>
          scrollToDate(15 Mar)
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.scrollToTask('5')}>
          scrollToTask(5)
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.extendTimeline('end')}>
          extendTimeline(&apos;end&apos;)
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.setSplitterPosition('30%')}>
          setSplitterPosition(30%)
        </Button>
      </div>
      <Gantt<Task>
        ref={apiRef}
        aria-label="Mobile app 2.0 timeline"
        data={tasks}
        taskFields={{ parentId: 'parentId' }}
        columns={COLUMNS}
        timeZone="UTC"
        locale="en-GB"
        dateFormat="dd.MM.yyyy"
        timeline={timeline}
        highlightWeekends
        markers={[
          { date: '2027-02-01', label: 'Funding review' },
          { date: '2027-03-22', label: 'Marketing launch', className: 'demo-marker' },
        ]}
        splitter={{ position: '40%', minSize: 160 }}
        panes={panes}
        height={420}
        onZoomChange={(e) => setZoom(`onZoomChange: level ${e.level} (from ${e.previous})`)}
        onSplitterResizeEnd={(e) => setStatus(`onSplitterResizeEnd: ${Math.round(e.position)} px`)}
      />
      <p className="demo-status" aria-live="polite">
        {[zoom, status].filter(Boolean).join(' · ') || 'Zoom with Ctrl+wheel over the chart, or drag the splitter'}
      </p>
    </div>
  );
}
```

## Chart

Taskbars show progress, summary bars, milestones (diamonds), baselines
(`baselines`), split segments, indicators (the `indicators` role), labels
(`labels.start`, `labels.end`, `labels.inside`) and connectors with arrows.
`rowHeight`, `getRowHeight` and `taskbarHeight` size them; the grid and the
chart share one row metric. `renderTaskbar`, `renderParentTaskbar`,
`renderMilestone` and `renderBaseline` replace parts; `getTaskbarProps(ctx)`
adds classes, styles and `data-*` attributes per task. Parts are
`.salmon-gantt__taskbar`, `__progress`, `__summary`, `__milestone`,
`__baseline`, `__segment`, `__connector`, `__marker` and `__holiday`, with
`data-critical`, `data-manual`, `data-selected` and `data-parent`.
`onTaskbarClick` reports clicks on bars (a click also selects the row),
`onRowDoubleClick` double clicks on grid rows, and `onChartPointerMove` the
date and task under the pointer, at most once per animation frame.

### Live demo: Gantt baselines, labels and templates

Live demo: https://salmonui.dev/demos/calendars/gantt-appearance

A conference plan with planned baselines and a baseline template, owner and progress labels, an indicator, taskbar, baseline and connector tooltips, custom taskbar, parent and milestone templates, per-task taskbar props, row and taskbar heights and root class and style.

`Demo.tsx`:

```tsx
'use client';

import { useState } from 'react';
import { Gantt, type GanttProps } from '@salmonui/gantt';
import { Checkbox } from '@salmonui/inputs/checkbox';
import { Select } from '@salmonui/dropdowns/select';

type Task = {
  id: number;
  title: string;
  parentId: number | null;
  start?: string;
  duration?: number;
  progress?: number;
  predecessors?: string;
  baselineStart?: string;
  baselineEnd?: string;
  owner?: string;
  risk?: 'low' | 'high';
  indicators?: { date: string; label: string; tooltip?: string }[];
};

const tasks: Task[] = [
  { id: 1, title: 'Conference 2027', parentId: null },
  { id: 2, title: 'Venue booking', parentId: 1, start: '2027-05-03', duration: 4, progress: 100, baselineStart: '2027-05-03', baselineEnd: '2027-05-05', owner: 'Ana', risk: 'low' },
  { id: 3, title: 'Speaker lineup', parentId: 1, duration: 8, progress: 60, predecessors: '2FS', baselineStart: '2027-05-06', baselineEnd: '2027-05-13', owner: 'Ben', risk: 'high', indicators: [{ date: '2027-05-12', label: 'Keynote confirmed', tooltip: 'The keynote speaker signed' }] },
  { id: 4, title: 'Ticket sales', parentId: 1, duration: 10, progress: 25, predecessors: '3SS+3d', baselineStart: '2027-05-10', baselineEnd: '2027-05-21', owner: 'Chen', risk: 'low' },
  { id: 5, title: 'Doors open', parentId: 1, duration: 0, predecessors: '3FS,4FS', owner: 'Ana' },
];


const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['title', 'start', 'end', 'baselineStart', 'baselineEnd', 'progress'];
/** Taskbar and row sizes, baselines with their own template, taskbar, parent and milestone templates, indicators, labels, tooltips, per-task taskbar props and the theme parts. */
export default function GanttAppearanceDemo() {
  const [templates, setTemplates] = useState(true);
  const [rowHeight, setRowHeight] = useState(40);
  const [status, setStatus] = useState('');
  return (
    <div>
      <div className="demo-toolbar">
        <Checkbox checked={templates} onCheckedChange={(checked) => setTemplates(checked)}>
          Custom taskbar templates
        </Checkbox>
        <label>
          Row height
          <Select aria-label="Row height" data={[{ value: 32, label: '32 px' }, { value: 40, label: '40 px' }, { value: 52, label: '52 px' }]} value={rowHeight} onValueChange={(value) => value != null && setRowHeight(Number(value))} />
        </label>
      </div>
      <Gantt<Task>
        aria-label="Conference plan with baselines"
        data={tasks}
        taskFields={{ parentId: 'parentId' }}
        columns={COLUMNS}
        timeZone="UTC"
        locale="en-GB"
        height={360}
        width="100%"
        className="demo-gantt"
        rowHeight={rowHeight}
        taskbarHeight={Math.round(rowHeight * 0.5)}
        baselines
        renderBaseline={({ width }) => <span className="demo-baseline" style={{ display: 'block', inlineSize: width, blockSize: '100%', background: 'var(--salmon-color-info-subtle)' }} />}
        labels={{ start: 'owner', end: ({ progress }) => `${Math.round(progress)}%`, inside: 'title' }}
        tooltip={{
          renderTaskbar: ({ task, start, end, progress }) => `${task.title}: ${start?.toISOString().slice(0, 10)} to ${end?.toISOString().slice(0, 10)}, ${Math.round(progress)}% done, owner ${task.owner ?? 'none'}`,
          renderBaseline: ({ task }) => `Planned: ${task.baselineStart ?? '?'} to ${task.baselineEnd ?? '?'}`,
          renderConnector: ({ from, to, dependency }) => `${from.title} → ${to.title} (${dependency.type.toUpperCase()})`,
        }}
        onBeforeTooltipOpen={(e) => setStatus(`onBeforeTooltipOpen: ${e.kind}${e.task ? ` of ${e.task.title}` : ''}`)}
        getTaskbarProps={({ task, critical }) => ({ 'data-risk': task.risk ?? 'none', ...(task.risk === 'high' ? { style: { outline: '2px solid var(--salmon-color-danger)' } } : {}), ...(critical ? { className: 'demo-critical' } : {}) })}
        {...(templates
          ? {
              renderTaskbar: ({ task, progress, width }) => (
                <span style={{ display: 'flex', alignItems: 'center', boxSizing: 'border-box', blockSize: '100%', inlineSize: width, borderRadius: 'var(--salmon-radius-full)', background: `linear-gradient(90deg, var(--salmon-color-primary) ${progress}%, var(--salmon-color-primary-subtle) ${progress}%)`, color: 'var(--salmon-color-primary-contrast, #fff)', paddingInline: 6, fontSize: 11, overflow: 'hidden' }}>
                  {task.title}
                </span>
              ),
              renderParentTaskbar: ({ width, progress }) => <span style={{ display: 'block', inlineSize: width, blockSize: 6, marginBlockStart: 8, background: 'var(--salmon-text-secondary)', opacity: 0.4 + progress / 200 }} />,
              renderMilestone: () => <span aria-hidden="true" style={{ fontSize: 18 }}>🚩</span>,
            }
          : {})}
      />
      <p className="demo-status" aria-live="polite">
        {status || 'Hover a taskbar, a baseline or a connector'}
      </p>
    </div>
  );
}
```

## Editing

`editing` (default on unless `readOnly`): `mode` `'auto'` edits cells in the
grid and opens the dialog from the chart, `'dialog'` always uses the dialog.
Taskbars move, resize from either end and change progress by dragging, snapped
to the bottom tier unit (days on week and month scales); dragging from a
connector point to another taskbar adds a dependency. Every pointer move only
writes the bar's style; the engine runs once at the end. `onTaskbarEditStart`,
`onTaskbarEdit` (once per frame), `onBeforeTaskbarEditEnd` and
`onTaskbarEditEnd` report the edit. `taskbarDragBetweenRows` moves a task to
another row.

The dialog has General, Dependency, Resources, Notes and Segments tabs, or the
tabs of `editing.dialogTabs` (custom tabs render your content). Methods:
`addTask(task, { position, targetId })`, `updateTask`, `deleteTasks`,
`changeTaskId`, `indent`, `outdent`, `moveTasks`, `addDependency`,
`removeDependency`, `updateDependencies`, `splitTask`, `mergeSegments`,
`convertToMilestone`, `convertToTask`, `setTaskMode`, `openAddDialog`,
`openEditDialog`. `undo` (`true` or `{ actions, limit }`) records every
change: `api.undo()`, `api.redo()`, `getUndoActions()`, `getRedoActions()`,
`clearUndo()`, `clearRedo()`, Ctrl+Z and Ctrl+Y.

`toolbar` lists `'add'`, `'edit'`, `'update'`, `'delete'`, `'cancel'`,
`'expandAll'`, `'collapseAll'`, `'search'`, `'previousTimeSpan'`,
`'nextTimeSpan'`, `'zoomIn'`, `'zoomOut'`, `'zoomToFit'`, `'indent'`,
`'outdent'`, `'criticalPath'`, `'excelExport'`, `'csvExport'`, `'pdfExport'`,
`'undo'`, `'redo'` and custom items (`onToolbarItemClick`). `contextMenu`
adds `'taskInformation'`, `'deleteTask'`, `'addAbove'`, `'addBelow'`,
`'addChild'`, `'addMilestone'`, `'convertToTask'`, `'convertToMilestone'`,
`'deleteDependency'`, `'indent'`, `'outdent'`, `'splitTask'` and
`'mergeTask'` to the Data Grid items, in both panes.

### Live demo: Gantt editing and undo

Live demo: https://salmonui.dev/demos/calendars/gantt-editing

A website relaunch plan edited in grid cells, in a task dialog with a custom Owner tab and by dragging taskbars, their ends, progress and connector points, with add, delete, indent, milestones, dependency methods, undo and redo, the toolbar, read-only mode and chart events.

`Demo.tsx`:

```tsx
'use client';

import { useRef, useState } from 'react';
import { Gantt, type GanttApi, type GanttProps } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Checkbox } from '@salmonui/inputs/checkbox';
import { Select } from '@salmonui/dropdowns/select';
import { TextField } from '@salmonui/inputs/text-field';

type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; progress?: number; predecessors?: string; notes?: string; milestone?: boolean; owner?: string };

const initial: Task[] = [
  { id: 1, title: 'Website relaunch', parentId: null },
  { id: 2, title: 'Discovery', parentId: 1 },
  { id: 3, title: 'Stakeholder interviews', parentId: 2, start: '2027-03-01', duration: 3, progress: 100, notes: 'Eight interviews, notes in the wiki.' },
  { id: 4, title: 'Content audit', parentId: 2, duration: 2, progress: 60, predecessors: '3FS' },
  { id: 5, title: 'Design', parentId: 1 },
  { id: 6, title: 'Wireframes', parentId: 5, duration: 4, progress: 30, predecessors: '4FS' },
  { id: 7, title: 'Visual design', parentId: 5, duration: 5, predecessors: '6FS' },
  { id: 8, title: 'Design sign-off', parentId: 5, duration: 0, predecessors: '7FS' },
  { id: 9, title: 'Build', parentId: 1 },
  { id: 10, title: 'Templates', parentId: 9, duration: 6, predecessors: '8FS' },
  { id: 11, title: 'Content migration', parentId: 9, duration: 4, predecessors: '10SS+2d' },
  { id: 12, title: 'Launch', parentId: 1, duration: 0, predecessors: '10FS,11FS' },
];


const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['id', 'title', 'start', 'end', 'duration', 'progress', 'predecessors', 'notes'];
/** Grid and dialog editing with custom tabs, taskbar move, resize, progress and link drags, add, delete, indent, milestones, undo and redo, the toolbar, read-only mode and the chart events. */
export default function GanttEditingDemo() {
  const apiRef = useRef<GanttApi<Task>>(null);
  const [tasks, setTasks] = useState<readonly Task[]>(initial);
  const [readOnly, setReadOnly] = useState(false);
  const [mode, setMode] = useState<'auto' | 'dialog'>('auto');
  const [pointer, setPointer] = useState('');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((lines) => [line, ...lines].slice(0, 10));
  const day = (d: Date | null) => (d ? d.toISOString().slice(0, 10) : '-');
  const selectedId = (): string | undefined => apiRef.current?.getSelectedRowIds()[0];
  return (
    <div>
      <div className="demo-toolbar">
        <Checkbox checked={readOnly} onCheckedChange={(checked) => setReadOnly(checked)}>
          readOnly
        </Checkbox>
        <label>
          Edit mode
          <Select aria-label="Edit mode" data={[{ value: 'auto', label: 'auto (cells and dialog)' }, { value: 'dialog', label: 'dialog' }]} value={mode} onValueChange={(value) => value != null && setMode(value as 'auto' | 'dialog')} />
        </label>
        <Button variant="outline" type="button" onClick={() => add(`addTask child of Build: ${apiRef.current?.addTask({ title: 'QA pass', duration: 2 }, { position: 'child', targetId: '9' }).status}`)}>
          addTask (child of Build)
        </Button>
        <Button variant="outline" type="button" onClick={() => add(`updateTask(4): ${apiRef.current?.updateTask('4', { title: 'Content audit (v2)', progress: 80 }).status}`)}>
          updateTask(4)
        </Button>
        <Button variant="outline" type="button" onClick={() => add(`convertToMilestone(7): ${apiRef.current?.convertToMilestone('7').status}`)}>
          convertToMilestone(7)
        </Button>
        <Button variant="outline" type="button" onClick={() => add(`addDependency(12, '6FS+1d'): ${apiRef.current?.addDependency('12', '6FS+1d').status}`)}>
          addDependency
        </Button>
        <Button variant="outline" type="button" onClick={() => add(`changeTaskId(11 to 110): ${apiRef.current?.changeTaskId('11', '110').status}`)}>
          changeTaskId(11, 110)
        </Button>
        <Button variant="outline"
          type="button"
          onClick={() => {
            const id = selectedId();
            if (id !== undefined) apiRef.current?.openEditDialog(id);
            else add('Select a row first');
          }}
        >
          openEditDialog(selected)
        </Button>
        <Button variant="outline" type="button" onClick={() => add(`undo stack: ${apiRef.current?.getUndoActions().join(', ') || 'empty'}`)}>
          getUndoActions()
        </Button>
      </div>
      <Gantt<Task>
        ref={apiRef}
        aria-label="Website relaunch plan"
        data={tasks}
        taskFields={{ parentId: 'parentId' }}
        columns={COLUMNS}
        timeZone="UTC"
        locale="en-GB"
        projectStart="2027-03-01"
        height={520}
        readOnly={readOnly}
        undo={{ limit: 50 }}
        inlineNotes
        editing={{
          mode,
          confirmDelete: true,
          newRowPosition: 'below',
          dialogTabs: [
            { type: 'general' },
            { type: 'dependency' },
            { type: 'notes' },
            {
              type: 'custom',
              label: 'Owner',
              render: ({ values, setValue }) => (
                <TextField label="Owner" value={String(values['owner'] ?? '')} onValueChange={(value) => setValue('owner', value)} />
              ),
            },
          ],
        }}
        toolbar={['add', 'edit', 'update', 'delete', 'cancel', 'indent', 'outdent', 'expandAll', 'collapseAll', 'undo', 'redo']}
        onTaskbarEditStart={(e) => add(`onTaskbarEditStart ${e.action} #${String(e.taskId)}`)}
        onBeforeTaskbarEditEnd={(e) => {
          if (e.action === 'progress' && e.progress > 100) e.preventDefault();
        }}
        onTaskbarEditEnd={(e) => add(`onTaskbarEditEnd ${e.action} #${String(e.taskId)}: ${day(e.start)} to ${day(e.end)}, ${Math.round(e.progress)}%`)}
        onDependencyChange={(e) => add(`onDependencyChange ${e.action} on #${String(e.taskId)}`)}
        onTaskChange={(e) => add(`onTaskChange ${e.action} [${e.taskIds.join(', ')}]`)}
        onTaskbarClick={(e) => add(`onTaskbarClick #${String(e.taskId)} (${e.target})`)}
        onRowDoubleClick={() => add('onRowDoubleClick')}
        onChartPointerMove={(e) => setPointer(`${day(e.date)}${e.task ? ` over ${e.task.title}` : ''}`)}
        onBeforeDialogOpen={(e) => add(`onBeforeDialogOpen ${e.mode}`)}
        onDataChange={(rows) => setTasks(rows)}
      />
      <p className="demo-status">Pointer: {pointer || 'move over the chart'}</p>
      <div className="demo-log" aria-live="polite">
        <ol>{log.length ? log.map((line, i) => <li key={`${i}-${line}`}>{line}</li>) : <li>Drag a taskbar or edit a cell</li>}</ol>
      </div>
    </div>
  );
}
```

## Resources

`resources` with `resourceFields` (`id`, `name`, `unit`, `group`) and the task
`resources` role (`{ id, unit }[]`) assign people; the resources column and
dialog tab show them.

`resourceView` groups the rows by resource: one parent row per resource (in
`resources` order) with its tasks, then an "Unassigned" row. A task with two
resources is listed under each; the second listing has the grid row key
`taskId@resourceId`, resource rows `__res:<resourceId>`, and every method still
takes task ids. `overAllocation` marks where a resource's summed units exceed
its `unit` (default 100 %): `data-part="overAllocation"` ranges in the
resource row and `data-over-allocated` on the bars inside them.
`multiTaskbar` draws a collapsed parent's children in its row and a
resource's tasks in the resource row; with `taskbarOverlap={false}`
overlapping bars stack in lanes and the row grows in both panes. With
`editing={{ taskbarDragBetweenRows: true }}` dropping a bar on another
resource's row moves the assignment there (on the Unassigned row it removes
it); in the project view the task moves below the target row, or into it when
the target is a parent.

```tsx
<Gantt data={tasks} resources={people} resourceView overAllocation multiTaskbar taskbarOverlap={false} editing={{ taskbarDragBetweenRows: true }} />
```

### Live demo: Gantt resources and split tasks

Live demo: https://salmonui.dev/demos/calendars/gantt-resources

People assigned with units, the resource view with an Unassigned row, over-allocated ranges, overlapping bars stacked in lanes, multi-taskbar rows, a task split into segments with split and merge, and taskbar drags that reassign people.

`Demo.tsx`:

```tsx
'use client';

import { useRef, useState } from 'react';
import { Gantt, type GanttApi, type GanttProps } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Checkbox } from '@salmonui/inputs/checkbox';

type Assignment = { id: string; unit: number };
type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; progress?: number; resources?: Assignment[]; segments?: { start: string; duration: number }[] };

const tasks: Task[] = [
  { id: 1, title: 'Office move', parentId: null },
  { id: 2, title: 'Pack archive', parentId: 1, start: '2027-06-07', duration: 4, progress: 50, resources: [{ id: 'ana', unit: 100 }] },
  { id: 3, title: 'Network plan', parentId: 1, start: '2027-06-08', duration: 3, resources: [{ id: 'ana', unit: 50 }, { id: 'ben', unit: 100 }] },
  { id: 4, title: 'Furniture order', parentId: 1, start: '2027-06-09', duration: 2, resources: [{ id: 'ben', unit: 100 }] },
  { id: 5, title: 'Cabling (split around the inspection)', parentId: 1, start: '2027-06-14', duration: 4, resources: [{ id: 'chen', unit: 100 }], segments: [{ start: '2027-06-14', duration: 1 }, { start: '2027-06-17', duration: 3 }] },
  { id: 6, title: 'Label boxes', parentId: 1, start: '2027-06-10', duration: 2 },
];

const people = [
  { id: 'ana', name: 'Ana', unit: 100, group: 'Facilities' },
  { id: 'ben', name: 'Ben', unit: 100, group: 'IT' },
  { id: 'chen', name: 'Chen', unit: 100, group: 'IT' },
];


const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['title', 'start', 'end', 'duration', 'resources'];
/** Resource assignments with units, the resource view with over-allocation, overlapping bars in lanes, multi-taskbar rows, split tasks and taskbar drags between rows. */
export default function GanttResourcesDemo() {
  const apiRef = useRef<GanttApi<Task>>(null);
  const [data, setData] = useState<readonly Task[]>(tasks);
  const [resourceView, setResourceView] = useState(true);
  const [multi, setMulti] = useState(true);
  const [overlap, setOverlap] = useState(false);
  const [status, setStatus] = useState('');
  return (
    <div>
      <div className="demo-toolbar">
        <Checkbox checked={resourceView} onCheckedChange={(checked) => setResourceView(checked)}>
          Resource view
        </Checkbox>
        <Checkbox checked={multi} onCheckedChange={(checked) => setMulti(checked)}>
          Bars in collapsed rows (multiTaskbar)
        </Checkbox>
        <Checkbox checked={!overlap} onCheckedChange={(checked) => setOverlap(!checked)}>
          Stack overlapping bars in lanes
        </Checkbox>
        <Button variant="outline" type="button" onClick={() => setStatus(`splitTask(4, 10 Jun): ${apiRef.current?.splitTask('4', '2027-06-10').status}`)}>
          splitTask(4, 10 Jun)
        </Button>
        <Button variant="outline" type="button" onClick={() => setStatus(`mergeSegments(5, [0, 1]): ${apiRef.current?.mergeSegments('5', [0, 1]).status}`)}>
          mergeSegments(5)
        </Button>
      </div>
      <Gantt<Task>
        ref={apiRef}
        aria-label="Office move resources"
        data={data}
        taskFields={{ parentId: 'parentId' }}
        columns={COLUMNS}
        resources={people}
        resourceFields={{ id: 'id', name: 'name', unit: 'unit', group: 'group' }}
        resourceView={resourceView}
        overAllocation
        multiTaskbar={multi}
        taskbarOverlap={overlap}
        editing={{ taskbarDragBetweenRows: true, dialogTabs: [{ type: 'general' }, { type: 'resources' }, { type: 'segments' }] }}
        contextMenu={['splitTask', 'mergeTask', 'taskInformation']}
        timeZone="UTC"
        locale="en-GB"
        height={440}
        onTaskChange={(e) => setStatus(`onTaskChange ${e.action} [${e.taskIds.join(', ')}]`)}
        onDataChange={(rows) => setData(rows)}
      />
      <p className="demo-status" aria-live="polite">
        {status || 'Drag a bar onto another person, or right-click a bar to split it'}
      </p>
    </div>
  );
}
```

## Tooltips

`tooltip` (or `{ renderTaskbar, renderBaseline, renderConnector }`) opens one
`Tooltip` on hovered or focused taskbars, milestones, baselines and
connectors with the title, dates, duration and progress;
`onBeforeTooltipOpen` can cancel it. It is a lazy chunk; import
`@salmonui/overlays/tooltip/styles.css` with it. Drags show their own editing
tip with the new dates.

## Export, print and state

`api.exportToExcel()` and `api.exportToCsv()` are the grid pane's exports
(tree rows as outline levels, with the Data Grid `cell` and `headerCell`
hooks); `api.exportToPdf(options)` draws both panes as
PDF vectors through `exportWriters.pdf`, a dynamic import of
`@salmonui/export/gantt` (`pageSize`, `orientation`, `fitToWidth`,
`header`, `footer`, `font`, and the `cell`, `headerCell`, `taskbar`,
`timelineCell` hooks). `api.print()` prints the rendered panes.
`api.getState()` / `api.restoreState()` hold the grid state, splitter, zoom and
scroll date; there is no built-in persistence.

## Keyboard and accessibility

The grid pane is the Data Grid treegrid with its keyboard model. Gantt keys:
Alt+Shift+Right / Left indent and outdent, Ctrl+Z / Ctrl+Y undo and redo, F6
moves focus between the panes. In the chart pane, Up / Down select the
previous / next task, Left / Right scroll the timeline (Ctrl: a page), Enter
opens the dialog and Ctrl+Plus / Ctrl+Minus zoom. Each taskbar is labelled
with its name, dates, progress, dependencies and critical state, and the grid
row is described by it. `dir="rtl"` runs the timeline right to left.

### Live demo: Gantt export, keyboard and languages

Live demo: https://salmonui.dev/demos/calendars/gantt-export-accessibility

Excel, CSV and vector PDF export through lazily loaded writers, print, the default context menu, the keyboard model and labelled taskbars, German strings, Arabic right to left, the adaptive one-pane layout and the task lookup methods.

`Demo.tsx`:

```tsx
'use client';

import { useRef, useState } from 'react';
import { Gantt, type GanttApi, type GanttExportWriters, type GanttProps } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Checkbox } from '@salmonui/inputs/checkbox';
import { Select } from '@salmonui/dropdowns/select';

type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; progress?: number; predecessors?: string };

const tasks: Task[] = [
  { id: 1, title: 'Annual report', parentId: null },
  { id: 2, title: 'Collect figures', parentId: 1, start: '2027-01-11', duration: 5, progress: 100 },
  { id: 3, title: 'Write chapters', parentId: 1, duration: 8, progress: 40, predecessors: '2FS' },
  { id: 4, title: 'Layout', parentId: 1, duration: 4, predecessors: '3FS' },
  { id: 5, title: 'Print run', parentId: 1, duration: 0, predecessors: '4FS' },
];

// Writers load on first use: dynamic imports of @salmonui/export subpaths.
const writers: GanttExportWriters = { excel: () => import('@salmonui/export/xlsx'), pdf: () => import('@salmonui/export/gantt') };

type Lang = 'en' | 'de' | 'ar';
const LANG: Record<Lang, Partial<GanttProps<Task>>> = {
  en: { locale: 'en-GB' },
  de: { locale: 'de-DE', localeText: { gridPane: 'Aufgaben', chart: 'Zeitachse', paneSwitch: 'Ansicht' } },
  ar: { locale: 'ar-EG', dir: 'rtl' },
};

const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['title', 'start', 'end', 'duration', 'progress'];
const TOOLBAR: NonNullable<GanttProps<Task>['toolbar']> = ['excelExport', 'csvExport', 'pdfExport', 'zoomIn', 'zoomOut'];

/** Excel, CSV and PDF export, print, the context menu, keyboard shortcuts and labelled taskbars, RTL, localization, the adaptive layout and the task lookup methods. */
export default function GanttExportAccessibilityDemo() {
  const apiRef = useRef<GanttApi<Task>>(null);
  const [lang, setLang] = useState<Lang>('en');
  const [narrow, setNarrow] = useState(false);
  const [status, setStatus] = useState('');
  return (
    <div>
      <div className="demo-toolbar">
        <label>
          Language
          <Select aria-label="Language" data={[{ value: 'en', label: 'English' }, { value: 'de', label: 'Deutsch' }, { value: 'ar', label: 'العربية (RTL)' }]} value={lang} onValueChange={(value) => value != null && setLang(value as Lang)} />
        </label>
        <Checkbox checked={narrow} onCheckedChange={(checked) => setNarrow(checked)}>
          Narrow container (adaptive)
        </Checkbox>
        <Button variant="outline" type="button" onClick={() => void apiRef.current?.exportToExcel({ fileName: 'annual-report', sheetName: 'Plan' }).then((f) => setStatus(f ? `${f.fileName}: ${f.data.byteLength} bytes` : 'cancelled'))}>
          Export Excel
        </Button>
        <Button variant="outline" type="button" onClick={() => void apiRef.current?.exportToCsv({ fileName: 'annual-report', separator: ';' }).then((f) => setStatus(f ? `${f.fileName}: ${f.data.split('\n').length} lines` : 'cancelled'))}>
          Export CSV
        </Button>
        <Button variant="outline" type="button" onClick={() => void apiRef.current?.exportToPdf({ fileName: 'annual-report', pageSize: 'A4', orientation: 'landscape', fitToWidth: true, header: 'Annual report plan', footer: 'Confidential' }).then((f) => setStatus(f ? `${f.fileName}: ${f.data.byteLength} bytes` : 'cancelled'))}>
          Export PDF
        </Button>
        <Button variant="outline" type="button" onClick={() => apiRef.current?.print()}>
          Print
        </Button>
        <Button variant="outline"
          type="button"
          onClick={() => {
            const i = apiRef.current?.getTaskInfo('3');
            setStatus(i ? `getTask(3): ${apiRef.current?.getTask('3')?.title}; level ${i.level}, parent ${String(i.parentId)}, ${apiRef.current?.getViewRows().length} view rows` : '');
          }}
        >
          getTask / getTaskInfo(3)
        </Button>
      </div>
      <div style={{ inlineSize: narrow ? 420 : '100%', maxInlineSize: '100%' }}>
        <Gantt<Task>
          key={lang}
          ref={apiRef}
          aria-label="Annual report plan"
          data={tasks}
          taskFields={{ parentId: 'parentId' }}
          columns={COLUMNS}
          timeZone="UTC"
          height={380}
          contextMenu
          toolbar={TOOLBAR}
          exportWriters={writers}
          adaptive={{ breakpoint: 640 }}
          onExport={(e) => setStatus(`onExport(${e.format}): ${e.fileName}`)}
          onContextMenuItemClick={(e) => setStatus(`onContextMenuItemClick: ${e.item}`)}
          {...LANG[lang]}
        />
      </div>
      <p className="demo-status" aria-live="polite">
        {status || 'Export, right-click a row or a bar, or press F6 to move between the panes'}
      </p>
    </div>
  );
}
```

## Splitter and panes

`splitter` (`position`, `columnIndex`, `minSize`) and `panes`
(`'both'`, `'grid'`, `'chart'`) place the panes on the public `Splitter`;
`api.setSplitterPosition()`, `onSplitterResizeStart`, `onSplitterResize`
(once per frame) and `onSplitterResizeEnd` report resizing.

### Adaptive layout

`adaptive` shows one pane at a time with a
"Tasks | Timeline" switch (`localeText.gridPane`, `localeText.chart`, group
label `localeText.paneSwitch`) and opens the task dialog full screen.
`adaptive` (`true`) is always adaptive, server markup included;
`adaptive={{ breakpoint: 640 }}` follows the Gantt's own width (a
`ResizeObserver`, so the server and hydration render both panes and the switch
appears after mount below the breakpoint). The task list stays mounted while
the timeline shows, so selection, scroll and expansion survive the switch.

```tsx
<Gantt data={tasks} adaptive={{ breakpoint: 720 }} timeZone="UTC" />
```

## Server rendering

With `timeZone` set, both panes render the grid's initial rows and the first
timeline window on the server with no today marker, and hydrate without
warnings.

### Live demo: Large Gantt projects

Live demo: https://salmonui.dev/demos/calendars/gantt-large

A deterministic 5,000-task project with chained dependencies, rows and timeline cells virtualized in both panes, server-rendered initial rows, a timed critical path toggle, a reschedule of every successor and a scroll to the last task.

`Demo.tsx`:

```tsx
'use client';

import { useMemo, useRef, useState } from 'react';
import { Gantt, type GanttApi, type GanttProps } from '@salmonui/gantt';
import { Button } from '@salmonui/buttons/button';
import { Checkbox } from '@salmonui/inputs/checkbox';

type Task = { id: number; title: string; parentId: number | null; start?: string; duration?: number; progress?: number; predecessors?: string };


const COLUMNS: NonNullable<GanttProps<Task>['columns']> = ['id', 'title', 'start', 'end', 'duration'];
/** 5,000 tasks: 500 phases of 9 chained tasks, each phase linked to the previous one. Deterministic, so server and client agree. */
function bigProject(phases: number): Task[] {
  const out: Task[] = [];
  let id = 1;
  for (let p = 0; p < phases; p++) {
    const parent = id++;
    out.push({ id: parent, title: `Phase ${p + 1}`, parentId: null });
    for (let c = 0; c < 9; c++) {
      const tid = id++;
      const first = p === 0 && c === 0;
      out.push({ id: tid, title: `Task ${tid}`, parentId: parent, duration: 1 + (tid % 3), progress: (tid * 7) % 100, ...(first ? { start: '2027-01-04' } : { predecessors: String(c === 0 ? tid - 2 : tid - 1) }) });
    }
  }
  return out;
}

/** A 5,000-task project with row and timeline virtualization in both panes, server-rendered initial rows and a timed critical path toggle. */
export default function GanttLargeDemo() {
  const tasks = useMemo(() => bigProject(500), []);
  const apiRef = useRef<GanttApi<Task>>(null);
  const [critical, setCritical] = useState(false);
  const [status, setStatus] = useState('');
  const timeIt = (label: string, fn: () => void) => {
    const t0 = performance.now();
    fn();
    requestAnimationFrame(() => setTimeout(() => setStatus(`${label}: ${(performance.now() - t0).toFixed(0)} ms to the next frame`), 0));
  };
  return (
    <div>
      <div className="demo-toolbar">
        <Checkbox checked={critical} onCheckedChange={(checked) => timeIt('Critical path', () => setCritical(checked))}>
          Critical path
        </Checkbox>
        <Button variant="outline" type="button" onClick={() => timeIt('scrollToTask(4999)', () => apiRef.current?.scrollToTask('4999'))}>
          scrollToTask(4999)
        </Button>
        <Button variant="outline" type="button" onClick={() => timeIt('updateTask(2, 5 days)', () => apiRef.current?.updateTask('2', { duration: 5 }))}>
          Lengthen the first task (reschedules 4,999 tasks)
        </Button>
        <Button variant="outline" type="button" onClick={() => setStatus(`DOM rows: ${apiRef.current?.getChartElement()?.querySelectorAll('.salmon-gantt__row').length ?? 0} of ${tasks.length}`)}>
          Count rendered chart rows
        </Button>
      </div>
      <Gantt<Task>
        ref={apiRef}
        aria-label="A project of 5,000 tasks"
        data={tasks}
        taskFields={{ parentId: 'parentId' }}
        columns={COLUMNS}
        criticalPath={critical}
        timeZone="UTC"
        locale="en-GB"
        timeline={{ mode: 'week' }}
        height={480}
        editing
      />
      <p className="demo-status" aria-live="polite">
        {status || `${tasks.length.toLocaleString('en-US')} tasks; scroll both panes`}
      </p>
    </div>
  );
}
```

## State, lifecycle and events

- **State.** Components never write to browser storage.
  `api.getState()` returns `{ grid, splitter, zoom, scrollDate }`, covering
  the Data Grid state, splitter position, zoom level and scroll date, and
  `api.restoreState(state)` applies it; store the snapshot yourself.
- **Data updates.** Tasks have stable ids and the engine updates
  rows incrementally by id on every data change, so there is no immutable
  mode. A new `data` array with the same task ids keeps row DOM, expansion,
  selection and scroll, and only changed tasks re-render.
- **Templates.** Customize with `renderTaskbar`,
  `renderBaseline` and the other render props. There are no HTML string
  templates; text from data is always escaped.
- **Agent tools.** Register your own tools over `GanttApi`
  methods such as `addTask`, `updateTask`, `addDependency` and
  `getCriticalTasks`, with your own confirmation step; components do not
  register WebMCP tools.
- **Lifecycle.** `onReady(api)` fires after the first commit;
  props are declarative, and unmounting tears everything down.
- **Action events.** `onBeforeTaskChange`,
  `onBeforeTaskbarEditEnd`, `onBeforeDependencyChange`, the Data Grid
  pairs in the grid pane, and `onError({ error, action, taskIds })` for
  failures; `event.preventDefault()` cancels.

## API reference

The API reference for [`@salmonui/gantt`](https://salmonui.dev/docs/reference/gantt)
lists every prop, method and type.
