Vanilla Breeze

gantt-chart

HTML-first Gantt chart using native table, progress, and time elements with progressive enhancement to an interactive timeline.

Overview

A web component that progressively enhances a semantic <table> into an interactive Gantt timeline. Without JavaScript, users see a fully readable data table with native <progress> bars and <time> elements. With JavaScript, the component renders a visual timeline with positioned bars, swim lane groups, milestones, progress fill, and a today marker.

Attributes

AttributeTypeDefaultDescription
titlestringChart heading
srcstring (URL)Path to JSON task data
viewstring"auto"Timeline granularity: auto, day, week, month, quarter
show-todaybooleanShow vertical today marker
show-progressbooleanShow progress fill inside bars
show-dependenciesbooleanDraw dependency arrows between tasks
compactbooleanReduced row height and spacing

Task Row Attributes

Each <tr> in the table body can carry these data attributes to configure the corresponding task bar.

AttributeTypeDescription
data-task-idstringUnique task identifier
data-groupstringSwim lane group (tasks with the same group are visually clustered)
data-dependsstringComma-separated task IDs this task depends on
data-statusstringnot-started, in-progress, done, or blocked
data-assigneestringAssignee name
data-milestonebooleanRenders a diamond marker instead of a duration bar
data-colorstringCustom bar color (CSS color value)

How It Works

The component reads task data from the semantic table structure:

  • Task name — from the first <td> text
  • Start/end dates — from <time datetime="..."> elements
  • Progress — from <progress value="..." max="...">
  • Metadata — from data-* attributes on the <tr>

Each bar is positioned at left: (taskStart - rangeStart) / rangeTotal * 100% with width: (taskEnd - taskStart) / rangeTotal * 100%. The timeline granularity auto-adjusts based on the date range, or can be set explicitly via the view attribute.

Data Mode

Load task data from JSON via the src attribute. The component creates the semantic table internally.

Events

EventDetailWhen
gantt-chart:ready { taskCount, dateRange } After the component finishes rendering
gantt-chart:task-click { task } When a task bar or milestone is clicked

CSS Custom Properties

VariableDefaultDescription
--gc-task-width180pxLeft panel (task names) width
--gc-row-height36pxRow height for tasks and bars
--gc-bar-colorvar(--color-interactive)Per-bar color override

Accessibility

  • The original <table> stays in the DOM (visually hidden) so screen readers get full table semantics with <th>, <time>, and <progress>
  • Each bar has role="img" and a descriptive aria-label
  • Bars are focusable via tabindex="0" for keyboard navigation
  • An aria-live="polite" region announces task selection
  • All transitions respect prefers-reduced-motion: reduce
  • Print styles show the original table and hide the visual chart

Related