Charts

Copy-paste chart examples for every Bklit UI component.

Gantt Chart - Subscriptions

Subscription phases per customer: patterned trials, gradient upgrades, Today chip that reveals last month, Week / Month zoom and a linked legend

const config = {  trial: { label: "Trialing", pattern: "diagonal-up" },  active: { label: "Active", color: "color-mix(in oklab, var(--chart-foreground) 38%, transparent)" },  upgrade: { label: "Upgraded", gradient: { from: "var(--chart-2)", to: "var(--chart-1)" } },  paused: { label: "Paused", color: "oklch(0.769 0.188 70.08 / 0.8)" },  pastDue: { label: "Past due", color: "oklch(0.637 0.237 25.331 / 0.8)" },  scheduled: { label: "Scheduled", stroke: "var(--chart-foreground)", strokeStyle: "dashed" },} satisfies GanttConfig;const [scale, setScale] = useState<GanttScaleName>("month");const [highlighted, setHighlighted] = useState<string | null>(null);const items = ganttLegendItems(config);<div className="flex flex-wrap items-center justify-between gap-3 pb-4">  <GanttScaleToggle value={scale} onValueChange={setScale} />  <Legend    className="flex-row"    items={items}    onHoverChange={(i) => setHighlighted(i === null ? null : items[i].kind)}  >    <LegendItem className="flex items-center gap-1.5">      <GanttLegendMarker config={config} />      <LegendLabel />    </LegendItem>  </Legend></div><GanttChart  data={subscriptions}  config={config}  scale={scale}  onScaleChange={setScale}  highlightedKind={highlighted}>  <GanttLabels title="Customer">    {(row) => (      <>        <GanttLabel>{row.name}</GanttLabel>        <GanttLabelDescription>{row.datum.plan} · {row.datum.price}/mo</GanttLabelDescription>      </>    )}  </GanttLabels>  <GanttAxis position="top" />  <GanttToday />  <GanttGrid />  <GanttBars    endLabel={({ datum }) => (datum.endsAt ? `Ends ${format(datum.endsAt)}` : null)}    notches={({ datum }) => renewalsOf(datum)}  />  <GanttAxis position="bottom" />  <GanttTooltip /></GanttChart>

Trending up by 5.2% this month

Gantt Chart - Dependencies & progress

A project plan: finish → start step links with curved or angled corners, progress fills, weekend bands, a code-freeze deadline and a dashed grid that fades at the edges

const config = {  research: { label: "Research", color: "var(--chart-3)" },  design: { label: "Design", color: "var(--chart-2)" },  build: { label: "Build", color: "var(--chart-1)" },  qa: { label: "QA", color: "var(--chart-4)" },  launch: { label: "Launch", gradient: { from: "var(--chart-4)", to: "var(--chart-5)" } },} satisfies GanttConfig;// Each task: { id, name, start, end, progress: 0–1, dependencies: ["id" | { id, type: "SS" }] }<GanttChart data={tasks} config={config}>  <GanttLabels title="Task" width={200} />  <GanttAxis position="top" />  <GanttToday />  <GanttWeekends />  <GanttGrid fadeVertical strokeDasharray="3 3" />  <GanttDeadline date={freeze} fillType="gradient" label="Code freeze" />  <GanttDependencies curve="step" corner="round" strokeDasharray="4 4" />  <GanttBars radius={11} track={false} startLabel={false} />  <GanttAxis position="bottom" />  <GanttTooltip /></GanttChart>

Gantt Chart - Gradient roadmap

One gradient per phase, no tracks, rounded bars; opens with the previous month revealed

const config = {  design: { label: "Design", gradient: { from: "var(--chart-3)", to: "var(--chart-2)" } },  build: { label: "Build", gradient: { from: "var(--chart-1)", to: "var(--chart-2)" } },  launch: { label: "Launch", gradient: { from: "var(--chart-4)", to: "var(--chart-5)" } },} satisfies GanttConfig;const [scale, setScale] = useState<GanttScaleName>("month");<GanttScaleToggle className="mb-4" value={scale} onValueChange={setScale} /><GanttChart  data={projects}  config={config}  scale={scale}  onScaleChange={setScale}  defaultRevealed  rowHeight={48}  barHeight={22}>  <GanttLabels title="Project" width={200}>    {(row) => (      <>        <GanttLabel>{row.name}</GanttLabel>        <GanttLabelDescription>{row.datum.owner}</GanttLabelDescription>      </>    )}  </GanttLabels>  <GanttAxis position="top" />  <GanttToday />  <GanttGrid />  <GanttBars radius={11} track={false} startLabel={false} />  <GanttAxis position="bottom" />  <GanttTooltip /></GanttChart>

Gantt Chart - Patterns & outlines

Plot only, no label column: names sit inside the bars, tentative shifts are hatched with a dashed outline, and with the date pill off the axis highlights the hovered day

const config = {  confirmed: { label: "Confirmed", color: "var(--chart-1)" },  tentative: {    label: "Tentative",    pattern: "diagonal-down",    patternColor: "var(--chart-1)",    stroke: "color-mix(in oklab, var(--chart-1) 60%, transparent)",    strokeStyle: "dashed",  },  freeze: { label: "Code freeze", pattern: "dots", color: "var(--chart-5)" },} satisfies GanttConfig;<GanttChart data={schedule} config={config}>  <GanttGrid />  <GanttBars startLabel={false} segmentLabel={(_, row) => row.name} />  <GanttAxis position="bottom" />  {/* No date pill: the axis highlights the hovered day instead. */}  <GanttTooltip showDatePill={false} /></GanttChart>

Gantt Chart - Controlled scale & reveal

Toolbar outside the chart: scale and reveal are controlled state, and the in-chart Today chip stays in sync

const [scale, setScale] = useState<GanttScaleName>("week");const [revealed, setRevealed] = useState(false);<GanttScaleToggle value={scale} onValueChange={setScale} /><button onClick={() => setRevealed((r) => !r)}>  {revealed ? "Hide past" : "Show past"}</button><GanttChart  data={subscriptions}  config={config}  scale={scale}  onScaleChange={setScale}  revealed={revealed}  onRevealedChange={setRevealed}>  <GanttLabels title="Customer" width={180} />  <GanttAxis position="top" />  <GanttToday />  <GanttGrid />  <GanttBars />  <GanttAxis position="bottom" />  <GanttTooltip /></GanttChart>