Skip to content

Build A Production Gantt Project

This tutorial starts with any framework quick start and builds toward the same data flow used by the full showcase.

Source code
src/components/gantt/gantt-showcase/GanttShowcase.ts
import '@revolist/ui/styles.scss';
import { createControl } from '@revolist/ui';
import './gantt-showcase.scss';
import { defineCustomElements } from '@revolist/revogrid/loader';
defineCustomElements();
import { GanttPlugin } from '@revolist/gantt';
import { ExportExcelPlugin, RowStatusPlugin } from '@revolist/revogrid-pro';
import {
STANDARD_CALENDAR,
SHOWCASE_ASSIGNMENTS,
SHOWCASE_BASELINES,
SHOWCASE_COLUMNS_WITH_COMPLETION,
SHOWCASE_DEFAULT_HIDDEN,
SHOWCASE_DEPENDENCIES,
SHOWCASE_GANTT_CONFIG,
SHOWCASE_RESOURCES,
SHOWCASE_TASKS,
renderShowcaseTaskBarColor,
renderShowcaseTaskBarContent,
} from '../shared/gantt-project-data';
import { currentTheme } from '../../composables/useRandomData';
// ─── Entry point ──────────────────────────────────────────────────────────────
export function load(parentSelector: string): void {
const parent = document.querySelector(parentSelector);
if (!parent) return;
const darkTheme = currentTheme().isDark();
const container = document.createElement('div');
container.className = `gantt-showcase-shell grow h-full ${darkTheme ? 'gantt-showcase-shell--dark' : 'gantt-showcase-shell--light'}`;
parent.appendChild(container);
const grid = document.createElement('revo-grid') as HTMLRevoGridElement;
const controls = document.createElement('div');
controls.className = 'gantt-showcase-controls';
container.appendChild(controls);
grid.theme = darkTheme ? 'darkCompact' : 'compact';
grid.readonly = false;
grid.range = true;
grid.resize = true;
grid.rowSize = 42;
grid.rowHeaders = false;
grid.hideAttribution = true;
grid.autoSizeColumn = false;
grid.classList.add('gantt-showcase-grid');
grid.plugins = [GanttPlugin, ExportExcelPlugin, RowStatusPlugin];
grid.hideColumns = [...SHOWCASE_DEFAULT_HIDDEN];
grid.columns = [...SHOWCASE_COLUMNS_WITH_COMPLETION];
grid.source = [...SHOWCASE_TASKS];
grid.ganttDependencies = [...SHOWCASE_DEPENDENCIES];
grid.ganttCalendars = [{ ...STANDARD_CALENDAR }];
grid.ganttResources = [...SHOWCASE_RESOURCES];
grid.ganttAssignments = [...SHOWCASE_ASSIGNMENTS];
grid.ganttBaselines = [...SHOWCASE_BASELINES];
let showCriticalPath = Boolean(
SHOWCASE_GANTT_CONFIG.visuals.showCriticalPath,
);
let showBaseline = false;
function applyGanttConfig() {
grid.gantt = {
...SHOWCASE_GANTT_CONFIG,
visuals: {
...SHOWCASE_GANTT_CONFIG.visuals,
showCriticalPath,
showBaseline,
taskBarColorHook: renderShowcaseTaskBarColor,
taskBarContentHook: renderShowcaseTaskBarContent,
},
} as typeof grid.gantt;
}
function createToggle(
label: string,
checked: () => boolean,
onChange: (value: boolean) => void,
) {
const control = createControl(document, 'button', { class: 'rv-btn-sm' });
control.textContent = label;
const sync = () => {
control.setAttribute('aria-pressed', String(checked()));
control.classList.toggle('rv-btn-primary', checked());
};
control.addEventListener('click', () => {
onChange(!checked());
applyGanttConfig();
sync();
});
sync();
return control;
}
controls.append(
createToggle(
'Critical path',
() => showCriticalPath,
(value) => {
showCriticalPath = value;
},
),
createToggle(
'Baselines',
() => showBaseline,
(value) => {
showBaseline = value;
},
),
);
applyGanttConfig();
container.appendChild(grid);
}

The application recipes below live in the examples source browser. Copy their recipes/ files beside your code before using the relative imports; they are maintained examples rather than published Gantt exports.

  1. Add project hierarchy. Keep task rows flat and connect children with parentId.

    grid.source = [
    {
    id: 'delivery',
    name: 'Delivery',
    type: 'summary',
    startDate: '2026-07-14',
    duration: 8,
    },
    {
    id: 'design',
    parentId: 'delivery',
    name: 'Design',
    startDate: '2026-07-14',
    duration: 3,
    },
    {
    id: 'build',
    parentId: 'delivery',
    name: 'Build',
    startDate: '2026-07-17',
    duration: 5,
    },
    {
    id: 'launch',
    name: 'Launch',
    type: 'milestone',
    startDate: '2026-07-24',
    duration: 0,
    },
    ];
  2. Add dependencies. Use stable task IDs and one of FS, SS, FF, or SF.

    grid.ganttDependencies = [
    {
    id: 'd1',
    predecessorTaskId: 'design',
    successorTaskId: 'build',
    type: 'FS',
    lagDays: 0,
    },
    {
    id: 'd2',
    predecessorTaskId: 'build',
    successorTaskId: 'launch',
    type: 'FS',
    lagDays: 0,
    },
    ];
  3. Enable supported editing. The managed task columns route edits through Gantt scheduling and validation.

    grid.gantt = {
    ...grid.gantt,
    allowTaskCreate: true,
    taskCreateRow: true,
    contextMenu: {},
    };

    Inline cell editing, timeline drag/resize/progress handles, dependency drawing, the task editor, and the context menu all use the same project state. See Task Editing.

  4. Assign resources. Resources and assignments are separate collections so multiple resources can work on one task.

    grid.ganttResources = [
    {
    id: 'designer',
    name: 'Avery',
    role: 'Designer',
    calendarId: 'standard',
    allocationCapacity: 100,
    hourlyCost: 90,
    },
    ];
    grid.ganttAssignments = [
    {
    id: 'a1',
    taskId: 'design',
    resourceId: 'designer',
    allocationUnits: 100,
    workHours: 24,
    responsibility: 'Visual design',
    },
    ];
  5. Show schedule analysis. Critical path and baseline overlays are opt-in visual layers.

    grid.gantt = {
    ...grid.gantt,
    visuals: {
    ...grid.gantt?.visuals,
    showCriticalPath: true,
    showBaseline: true,
    baselineId: 'approved',
    },
    };
    grid.ganttBaselines = [
    {
    id: 'approved',
    name: 'Approved plan',
    capturedAt: '2026-07-14T00:00:00.000Z',
    tasks: [
    {
    taskId: 'design',
    startDate: '2026-07-14',
    endDate: '2026-07-16',
    duration: 24,
    progressPercent: 0,
    },
    {
    taskId: 'build',
    startDate: '2026-07-17',
    endDate: '2026-07-23',
    duration: 40,
    progressPercent: 0,
    },
    ],
    },
    ];
  6. Persist complete project snapshots. Keep application state authoritative and replace grid collections after a successful save or server update.

    import {
    exportProjectSnapshot,
    parseProjectSnapshotJson,
    } from '@revolist/gantt';
    const json = exportProjectSnapshot(snapshot, { space: 2 });
    const restored = parseProjectSnapshotJson(json);
    if (restored.ok) applyProject(restored.project);
  7. Add reporting actions. Grid CSV/Excel export covers task-table data; the print recipe prepares a combined task-table/timeline report.

    import { createPrintPdfExportRecipe } from './recipes/persistence-examples';
    const print = createPrintPdfExportRecipe({
    target: document.querySelector('#gantt')!,
    document,
    window,
    });
    print.exportProject(snapshot, { label: 'Delivery plan' });

Next, browse all Gantt examples, review configuration, or open the API reference.