Skip to content

GhostGantt ​

GhostGantt is a headless, date-only Gantt chart. It renders a schedule your app supplies: a task list with titles, dates, and dependencies, aligned with a timeline of bars, milestones, and finish-to-start connectors. Planners can inspect what blocks a task from the keyboard and propose new dates with Edit dates. The chart never schedules: it emits one editRequest, and your app accepts it by supplying revised tasks or rejects it through taskErrors.

Import it from @ghostvue/vue. It is headless, so it ships structure, ARIA, and day offsets but no visual styles: bring your own CSS through the styling hooks. The full contract is the GhostGantt specification.

Read-only release plan Headless

A named treegrid with one Tab stop: rows read their title, inclusive dates, and finish-to-start dependencies, including a link to a task that is not in the schedule. Arrow keys move between rows and expand or collapse the release.

Task
Dates
Dependencies
Release
June 1 to June 10, 10 days
Design
June 1 to June 3, 3 days
Before Build starts (finish-to-start)
Build
June 4 to June 6, 3 days
After Design finishes (finish-to-start) Before Review starts (finish-to-start)
Review
June 7, 1 day
After Build finishes (finish-to-start) Before Launch starts (finish-to-start)
Launch
Milestone, June 9
After Review finishes (finish-to-start) After a missing task, qa, finishes (finish-to-start; not in this schedule)
Docs
Not scheduled

Tab into the chart and move with the arrow keys. Each row reads its title and dates, then what it depends on. Launch also lists a link to qa, a task that is not in this schedule. ArrowLeft on Release collapses it and ArrowRight expands it again.

The date model ​

Every date is a CalendarDate from @internationalized/date, which @ghostvue/vue re-exports. A task's schedule is one of three kinds:

  • { kind: 'span', start, finish }: finish is inclusive, so June 1–3 occupies three days. A one-day task has start equal to finish.
  • { kind: 'milestone', date }: a zero-duration point, drawn as a marker. A one-day span and a milestone are different kinds with different text.
  • { kind: 'unscheduled' }: the task has a row but no bar.

The chart never reads a time, an instant, or the viewer's time zone, and it never converts dates to Date for layout. June 1–3 covers three day columns in every time zone, including days with a DST change. Pass range (the inclusive visible dates) and, if you want a marker, today yourself; the chart never calls new Date(), so server and client markup match. A task partly outside range keeps its full dates in the Dates column, and its bar is clipped.

Parent rows come from parentId. Sibling order is the order of tasks, and a parent's span is your data: the chart draws it as supplied and never rolls up its children.

Propose, then let the app decide ​

Edit dates Headless

Enter opens Edit dates on an editable row. The chart proposes one edit request; the application accepts it by supplying revised tasks, announces its own downstream changes with announce(), or rejects it with a taskErrors entry that is shown and announced.

Task
Dates
Dependencies
Release
June 1 to June 10, 10 days
Design
June 1 to June 3, 3 days
Before Build starts (finish-to-start)
Build
June 4 to June 6, 3 days
After Design finishes (finish-to-start) Before Review starts (finish-to-start)
Review
June 7, 1 day
After Build finishes (finish-to-start) Before Launch starts (finish-to-start)
Launch
Milestone, June 9
After Review finishes (finish-to-start)
Docs
Not scheduled

On an editable task (editable: true), Enter or F2 on the row opens the Edit dates dialog. The Edit dates button in the row does the same for pointer and screen reader users. A span shows Start and Finish fields, a milestone shows one Date field, and an unscheduled task shows empty Start and Finish fields.

Save checks only that the fields are filled in and that Finish is not before Start. It then closes the dialog, returns focus to the row, and emits editRequest once if the dates changed:

ts
interface GanttEditRequest {
  taskId: string
  intent:
    'move' | 'change-start' | 'change-finish' | 'change-dates' | 'schedule'
  proposed: GanttSpan | GanttMilestone
}

The intent is derived from the old and new dates. Moving Design from June 1–3 to June 3–5 is a move (same duration). Changing it to June 1–5 is a change-finish. Giving an unscheduled task dates is a schedule. Unchanged dates, Cancel, and Escape emit nothing.

The chart keeps showing the authoritative dates until you answer. Answer every request in one of two ways:

  • Accept: replace tasks with the revised schedule. You may also move other tasks by your own policy. The chart announces the accepted task ("Build: June 4 to June 8."). Describe any other changes you made with the exposed announce() method; when you call it in the same update, your message is read after the chart's.
  • Reject: leave tasks unchanged and add a new taskErrors entry object for the task, even when the message repeats an earlier one. The row shows the message, describes itself with it, and announces it once. Focus is not moved. The planner can open Edit dates again; the dialog shows the message too.

When you accept a retry for a task that has an error, remove its entry in the same update as the revised dates. The chart never hides or clears your messages.

If the task's dates change while its dialog is open, the fields reset to the new dates and the dialog says so ("Build changed to June 5 to June 7. Review the dates and save again."). If the task is removed, the dialog closes and focus moves to a nearby row. If it becomes read-only, the dialog closes as if canceled.

Selection ​

Rows have no selection state unless you bind v-model:selected. Then Space selects the focused row (selectionMode="single") or toggles it (selectionMode="multiple"), and the arrow keys only move focus. The chart never drops an ID from selected because its row is hidden, filtered out, or missing: it cannot tell a deletion from a filter. Remove the ID yourself after you confirm a deletion.

Expansion works the same way with v-model:expanded, or uncontrolled with defaultExpanded (all parents by default). IDs that are not parents are kept in the emitted array.

Keyboard ​

The chart is one Tab stop. Rows are the focus unit; cells are not focused separately.

KeyAction
Tab / Shift+TabEnter the chart on the remembered row (the first row the first time), or leave it.
ArrowDown / ArrowUpNext or previous visible row. No wrap.
Home / EndFirst or last visible row. Ctrl+Home and Ctrl+End do the same.
PageDown / PageUpMove by the number of fully visible rows.
ArrowRightExpand a collapsed parent, or move to the first child of an expanded one.
ArrowLeftCollapse an expanded parent, or move from a child to its parent.
Enter / F2Open Edit dates on an editable row.
SpaceSelect or toggle the row when selected is bound.
EscapeIn Edit dates, close without saving. On a row it is not handled, so an enclosing dialog closes.

In right-to-left layouts ArrowRight and ArrowLeft swap. Pass dir, or let the chart read the root's computed direction when a key is pressed.

Accessibility ​

  • Name the chart with aria-label or aria-labelledby. Development builds warn when neither is present.
  • The chart is a treegrid. Each row has its level, position, expanded state, and selected state (when bound). Its name is its title and dates ("Build, June 4 to June 6, 3 days"), and its description is its dependencies and any error.
  • The timeline (bars, milestones, connectors, the today marker, and the day labels) is aria-hidden: every fact it shows is also in the Dates and Dependencies text.
  • A dependency names the other task and its state: "(hidden in Release)" when it is inside a collapsed parent, "(not scheduled)", or "a missing task, qa, … (finish-to-start; not in this schedule)" when it is not in tasks.
  • One polite status element after the chart carries every announcement: an accepted request, a new rejection, a refreshed dialog, a removed row that had focus, and your own announce() messages. Emitting a request is not announced.
  • When the focused row's task is removed, focus moves to the next visible row, else the previous one, else the empty chart, and "Design is no longer shown." is announced. When focus is outside the chart, updates never move it.
  • The treegrid itself is the scroll surface. On narrow screens the timeline scrolls inside it, not the page.

Every string the chart renders or announces comes from messages, so pass overrides to localize them. Set locale for date text.

Styling hooks ​

The chart adds data-part values for each piece: root, treegrid, header, row, title, toggle, dates, edit-button, dependencies, timeline, bar, milestone, connector, today, error, empty, and status. Rows, bars, and markers carry state attributes such as data-kind, data-level, data-expanded, data-selected, data-editable, data-invalid, data-clipped-start, and data-clipped-finish; a dependency line whose other task is missing has data-dangling.

Positions are integer day offsets in custom properties, never pixels:

  • Bars and header labels: --ghost-gantt-offset (day columns from range.start) and --ghost-gantt-days.
  • Milestones and the today marker: --ghost-gantt-offset.
  • The treegrid: --ghost-gantt-range-days.
  • Connectors: --ghost-gantt-from-day, --ghost-gantt-from-row, --ghost-gantt-to-day, and --ghost-gantt-to-row.

Multiply them by your own --ghost-gantt-day-width and --ghost-gantt-row-height. The examples above carry a complete stylesheet to copy. The Edit dates dialog is portaled to the body; style it through [data-ghost-gantt-editor].

API ​

PropTypeDefaultDescription
defaultExpanded'all' | readonly string[]"all"Initial expanded parents when expanded is omitted.
dependenciesreadonly GanttDependency[]"[]"Finish-to-start links, rendered as supplied, including overlapping and dangling dependencies.
dirGanttDirection—Timeline and arrow direction. When omitted, read from the root's computed direction in the browser.
expandedreadonly string[]—Controlled expanded parent IDs (v-model:expanded). Omit for uncontrolled.
localestring"en-US"Intl locale for date text. Explicit so SSR and hydration format identically.
messagesPartial<GanttMessages>—Overrides for labels, descriptions, and announcements.
rangeGanttRangeRequiredInclusive visible dates. Required so server and client markup agree.
selectedreadonly string[]—Controlled selection (v-model:selected). When omitted, rows have no selection state.
selectionModeGanttSelectionMode"single"Used only when selected is bound.
taskErrorsreadonly GanttTaskError[]"[]"App-controlled messages; the chart never adds or clears entries.
tasksreadonly GanttTask[]RequiredApp-owned tasks. Sibling order is array order. Never sorted, filtered, cloned, or mutated.
todayCalendarDate—Optional today marker. Never computed with new Date().
EventPayloadDescription
editRequestGanttEditRequestProposes a completed, changed edit once, after Save in the Edit dates dialog: the dialog has closed and focus is back on the row. Not emitted for unchanged dates, Cancel, Escape, or when the task is removed or becomes read-only. The intent is derived from the authoritative and proposed dates. Answer every request with revised tasks or a new taskErrors entry object.
SlotSlot propsDescription
barerror: string | undefined, expanded: boolean | undefined, level: number, preview: GanttScheduledDates | undefined, selected: boolean | undefined, task: GanttTaskVisual label inside a bar. aria-hidden; must not contain focusable content.
empty—Content of the empty chart.
taskerror: string | undefined, expanded: boolean | undefined, level: number, preview: GanttScheduledDates | undefined, selected: boolean | undefined, task: GanttTaskTitle cell content. Must render text; the row's name is read from it. Default: task.title.

Template ref ​

MethodDescription
focusTask(id)Focuses a visible row and makes it the Tab stop. Returns false for a hidden or missing task.
announce(text)Sends a polite message through the chart's status element, for changes your app made to other tasks.

Not in this release ​

  • Dragging a bar or resizing its edges with pointer and touch. Edit dates is the way to change dates in this release.
  • Scheduling: rescheduling, dependency enforcement, critical paths, and parent roll-ups. Linked tasks that overlap are drawn as supplied.
  • Timed work, working calendars, zoom levels beyond days, dependency types other than finish-to-start, and virtualized rows.
  • A themed GhostGantt in @ghostvue/themes.