# Task grid

> Configure the task list columns, edit names, dates, durations, progress and predecessor text inline, indent and outdent tasks, and add or delete rows from the keyboard.

The left side of the Gantt is a task grid: a tree of tasks with one row per task, aligned with the bars on the timeline. It is built on the MIT Birch UI Grid core, so no Grid Pro license is involved, and it follows the WAI-ARIA treegrid pattern.

## Columns

By default the grid shows all seven built-in columns:

| Id | Header | Width | Editable |
| --- | --- | --- | --- |
| `'wbs'` | WBS | 72 | No |
| `'name'` | Task name | 240 | Yes |
| `'start'` | Start | 112 | Yes |
| `'end'` | Finish | 112 | Yes |
| `'duration'` | Duration | 90 | Yes |
| `'percentDone'` | % Complete | 96 | Yes |
| `'predecessors'` | Predecessors | 120 | Yes |

Choose and order columns with `columns`. Entries are built-in ids or column objects:

```ts
createGantt<RelaunchTask>(container, {
  tasks,
  dependencies,
  columns: [
    'wbs',
    { id: 'name', header: 'Deliverable', width: 280 },
    'start',
    'end',
    'duration',
    { id: 'owner', header: 'Owner', field: 'owner', width: 140 },
    { id: 'status', header: 'Status', width: 110, renderer: (task) => (task.percentDone >= 100 ? 'Done' : task.isCritical ? 'Critical' : 'On track') },
    { id: 'percentDone', editable: false },
  ],
});
```

| Field | Description |
| --- | --- |
| `id` | A built-in id, or your own unique id. |
| `header` | Header text. |
| `width` | Width in pixels. Defaults to the built-in width, or 120. |
| `field` | For custom columns: the task field to show, such as one of your own fields. |
| `renderer` | For custom columns: `(task) => string`, called with the scheduled task. The text is inserted as text. |
| `editable` | `false` makes a built-in column read-only. |
| `align` | `'left'`, `'center'` or `'right'`. |

Custom columns are read-only and need a `field` or a `renderer`; one without either is skipped with a warning. The name column is always present: if you leave it out, it is added at the front, because it holds the tree.

The grid starts as wide as its columns, up to 640 pixels. Set `gridWidth` to choose, and drag the splitter between grid and timeline to resize it (see [Interactions](https://docs.birchui.com/gantt/interactions.md#splitter)).

## Inline editing

Focus a cell and press <kbd>Enter</kbd> or <kbd>F2</kbd>, or just start typing. <kbd>Enter</kbd> commits and <kbd>Escape</kbd> cancels.

| Column | Accepted input | Effect |
| --- | --- | --- |
| Task name | Any text. | Renames the task. |
| Start | A date (a date picker opens on <kbd>Enter</kbd> and <kbd>F2</kbd>; typed text such as `2027-01-18` also works). | Moves the task and sets a **start no earlier than** constraint, as dragging does. |
| Finish | A date. A date without a time means the end of that working day. | Changes the duration so the task ends then. |
| Duration | `5`, `5d`, `16h`, `2w` (weeks of `daysPerWeek` days), `90min`. `0` makes a milestone. | Changes the duration. |
| % Complete | `40` or `40%`. | Sets progress. |
| Predecessors | Predecessor text, see below. | Replaces the task's incoming links. |

Input that cannot be read, such as `"next week"` in a date column or a link that would create a loop, is not applied, and the reason is announced in the live region ("Predecessors not changed: this link would create a dependency loop"). Summary tasks do not accept a duration or progress, because both are rolled up.

Edits go through `validateTaskChange` like drags do, with `source: 'edit'` and the typed value in `changes`, so you can refuse them:

```ts
createGantt(container, {
  tasks,
  dependencies,
  validateTaskChange: ({ task, changes, source }) => {
    if (task.isLocked) return false;
    if (source === 'edit' && 'name' in changes) return String(changes.name).trim().length > 0;
    return true;
  },
});
```

Successful edits emit `taskChange` with `source: 'edit'`, or `dependencyCreate` and `dependencyRemove` for predecessor edits, followed by `tasksScheduled`.

## Predecessor text

The predecessors column shows and edits a task's incoming links as text, in the notation MS Project uses:

| Text | Meaning |
| --- | --- |
| `3` | Finish-to-start from task 3. |
| `3FS+2d` | Finish-to-start with two working days of lag. |
| `5SS` | Start-to-start from task 5. |
| `1.2FF-4h` | Finish-to-finish from task 1.2, four working hours early (a lead). |
| `4FS+2ed` | Finish-to-start with two elapsed days of lag. |
| `3FS+2d, 5SS` | Two links, separated by commas or semicolons. |

A reference is a **WBS code** (`3`, `1.2`) or a task id. The type defaults to `FS`, and the lag unit to days; units are `min`, `h`, `d`, `w`, `eh` (elapsed hours) and `ed` (elapsed days). The column always shows WBS codes, and leaves out `FS` when there is no lag, so `2FS` reads `2`.

The parser and formatter are exported for your own forms and imports:

```ts
import { formatPredecessor, parsePredecessors } from '@birchui/gantt';

const { tokens, errors } = parsePredecessors('3FS+2d, 5SS, 1.2FF-4h');
const text = formatPredecessor('1.3', 'SS', 2, 'day');
```

Here `tokens` is `[{ ref: '3', type: 'FS', lag: 2, lagUnit: 'day' }, { ref: '5', type: 'SS', lag: 0, lagUnit: 'day' }, { ref: '1.2', type: 'FF', lag: -4, lagUnit: 'hour' }]`, `errors` is empty, and `text` is `'1.3SS+2d'`. `parsePredecessors(text, isKnownRef)` accepts an optional function that tells it which references exist, which lets it read ids that themselves end in letters such as `FS`.

## Indent and outdent

| Keys | Action |
| --- | --- |
| <kbd>Tab</kbd> or <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>ArrowRight</kbd> | Indent: the task becomes the last subtask of the task above it. |
| <kbd>Shift</kbd>+<kbd>Tab</kbd> or <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>ArrowLeft</kbd> | Outdent: the task moves up a level, after its parent, and the tasks that followed it under that parent become its subtasks. |

This is how outlining works in MS Project. When <kbd>Tab</kbd> cannot indent or outdent a row (the first row, or a top-level task), it moves focus as usual, so keyboard users can always leave the grid. Pass `tabToIndent: false` to keep <kbd>Tab</kbd> for focus only and use the <kbd>Alt</kbd>+<kbd>Shift</kbd> keys.

Links that would connect a summary to its own subtasks after the move are removed, and reported with `dependencyRemove`. From code, use `indent(id)` and `outdent(id)`, which return `false` when the move is not possible.

## Adding, deleting and expanding rows

| Keys | Action |
| --- | --- |
| <kbd>Insert</kbd> | Add a task above the focused row and start editing its name. |
| <kbd>Ctrl</kbd>/<kbd>Cmd</kbd>+<kbd>Enter</kbd> | Add a task below. |
| <kbd>Ctrl</kbd>/<kbd>Cmd</kbd>+<kbd>Delete</kbd> | Delete the task and its subtasks. |
| <kbd>ArrowRight</kbd> / <kbd>ArrowLeft</kbd> on a summary's name | Expand or collapse it. |

New tasks are called "New task", last one day and start where the neighbouring task starts. They emit `taskAdd`; deletions emit `taskRemove` for the task and each subtask. From code, use `expandTask(id)`, `collapseTask(id)`, `expandAll()` and `collapseAll()`, and `expanded: false` on a summary to start collapsed.

None of these keys change anything in `readOnly` mode.

## Next steps

- [Interactions](https://docs.birchui.com/gantt/interactions.md) for editing on the timeline.
- [Keyboard and accessibility](https://docs.birchui.com/gantt/accessibility.md) for the full key map.
