A Gantt task — one row in the chart, rendered as a horizontal bar on the time axis.
The struct intentionally carries ONLY Gantt-relevant fields. Use
the :extra map for everything else — badges, action buttons,
sub-project metadata, custom rendering hints, application-specific
data — without bloating the core type.
Required fields
:id— unique identifier within the chart (string or atom):start—Date(orDateTime/NaiveDateTimeif you want time-of-day precision later)
Optional schedule fields
:end— date the task ends.nilAND no children → milestone (zero-duration; renders as a diamond)nilAND has children (viaextra.parent_idon other tasks) → date range is rolled up from descendants- otherwise → bar spans
start..end
Display
:title— label rendered in the sidebar:description— optional longer text (not rendered by default):color— background CSS class (e.g."bg-primary"):text_color— override CSS class; falls back to a contrast pick from:color:icon— short inline glyph rendered next to the title:class— extra CSS classes appended to the bar
Project metadata
:category— phase / group label; tasks sharing a category cluster under a group header in the sidebar:status— one of:active,:tentative,:cancelled,:pending_approval,:blocked,:no_show— drives bar opacity / line-through / pulse / etc.:progress_pct— completion % (0-100); fills the bar:assignee— owner name; shown in popover subtitle
Extra map keys recognised by the renderer
parent_id— id of another task. If set, this task is a child of the referenced sub-project; the parent rolls up over its children's date range and can be expanded/collapsed.badges— list of%{content, corner, color, flash, ...}maps drawn in the bar's corners.actions— list of%{icon, tooltip, phx_click, ...}maps rendered as buttons inside the click popover.bus_stagger_outgoing_px/bus_stagger_incoming_px— per-task override for the connector stagger width.bus_attach_mode— per-task override for which side of the bar arrows connect to.
Anything you put in :extra that the renderer doesn't recognise
is silently passed through, so consumers can stuff their own
metadata next to it freely.
Summary
Functions
Returns the effective end of a task — what the renderer uses to compute the bar's right edge. Handles three cases
Convenience constructor: PhoenixLiveGantt.Task.new("id", start_date, opts).
Types
@type status() ::
:active | :tentative | :cancelled | :pending_approval | :blocked | :no_show
@type t() :: %PhoenixLiveGantt.Task{ assignee: String.t() | nil, category: String.t() | nil, class: String.t() | nil, color: String.t() | nil, description: String.t() | nil, end: Date.t() | DateTime.t() | NaiveDateTime.t() | nil, extra: map(), icon: String.t() | nil, id: term(), progress_pct: number() | nil, start: Date.t() | DateTime.t() | NaiveDateTime.t() | nil, status: status(), text_color: String.t() | nil, title: String.t() | nil }
Functions
@spec effective_end(t()) :: Date.t() | DateTime.t() | NaiveDateTime.t() | nil
Returns the effective end of a task — what the renderer uses to compute the bar's right edge. Handles three cases:
- Explicit
:endset → returned as-is. :endis nil with aDatestart → start + 1 day (so a one-day task gets a visible bar).:endis nil with aDateTime/NaiveDateTimestart → start- 30 minutes (matches calendar semantics for time-of-day tasks).
Convenience constructor: PhoenixLiveGantt.Task.new("id", start_date, opts).