Charts

Copy-paste chart examples for every Bklit UI component.

Heatmap Chart - Contributions

Activity grid with circular cells, calendar quarter separators, compact day labels, and synced legend hover

<HeatmapChart data={data} gap={3} layout="fluid">  <HeatmapCells    cornerRadius={999}    inactiveOpacity={0.8}    inactiveScale={0.94}  />  <HeatmapSeparator    groupBy="quarter"    showLabels    labelClassName="text-[var(--chart-3)]"    spacing={12}    startOffset={14}    strokeOpacity={0.6}  />  <HeatmapXAxis />  <HeatmapYAxis tickFilter="all" labelFormat="initial" />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend  align="center"  cornerRadius={999}  gap={3}  inactiveOpacity={0.8}  inactiveScale={0.94}/>

Trending up by 5.2% this month

Heatmap Chart

GitHub-style contribution grid with axes and tooltip (six months)

<HeatmapChart data={data} gap={3} layout="fluid">  <HeatmapCells inactiveOpacity={1} inactiveScale={1} />  <HeatmapXAxis />  <HeatmapYAxis />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend align="center" gap={3} inactiveOpacity={1} inactiveScale={1} />

Trending up by 5.2% this month

Heatmap Chart - Pattern Levels

Per-level pattern fills shared between chart and legend (six months)

<HeatmapChart data={data} gap={3} layout="fluid" levelStyles={levelStyles}>  <HeatmapCells />  <HeatmapXAxis />  <HeatmapYAxis />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend align="center" gap={3} levelStyles={levelStyles} />const levelStyles = [  { color: "var(--chart-scale-01)", fillMode: "solid", pattern: "none" },  { color: "var(--chart-scale-02)", fillMode: "solid", pattern: "none" },  {    color: "var(--chart-scale-03)",    fillMode: "pattern",    pattern: "diagonal",    patternColor: "var(--chart-scale-pattern-color)",  },  { color: "var(--chart-scale-04)", fillMode: "solid", pattern: "none" },  { color: "var(--chart-scale-05)", fillMode: "solid", pattern: "none" },] as const;

Trending up by 5.2% this month

Heatmap Chart - Solid Separators

Calendar quarter separators with a flat solid stroke (six months)

<HeatmapChart data={data} gap={3} layout="fluid">  <HeatmapCells />  <HeatmapSeparator    groupBy="quarter"    showLabels    labelClassName="text-black dark:text-white"    spacing={12}    startOffset={14}    stroke="var(--border)"    strokeStyle="solid"  />  <HeatmapXAxis />  <HeatmapYAxis tickFilter="odd" labelFormat="initial" />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend align="center" gap={3} />

Trending up by 5.2% this month

Heatmap Chart - Compact Y Axis & Quarter Separators

Mon / Wed / Fri labels, quarter separators with a vertical fade gradient (six months)

<HeatmapChart data={data} gap={3} layout="fluid">  <HeatmapCells />  <HeatmapSeparator    groupBy="quarter"    showLabels    labelClassName="text-black dark:text-white"    spacing={12}    startOffset={14}    strokeStyle="solid"    stroke="var(--muted)"    gradient={{      from: "var(--muted)",      via: "var(--muted)",      to: "var(--muted)",      fromOpacity: 0,      viaOpacity: 1,      toOpacity: 0,    }}  />  <HeatmapXAxis />  <HeatmapYAxis tickFilter="odd" labelFormat="initial" />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend align="center" gap={3} />

Trending up by 5.2% this month

Heatmap Chart - Dashed Separators

Quarter separators without a Y axis — dashed lines with vertical fade (six months)

<HeatmapChart data={data} gap={3} layout="fluid">  <HeatmapCells />  <HeatmapSeparator    groupBy="quarter"    showLabels    spacing={12}    startOffset={14}    strokeStyle="dashed"    strokeDasharray="3,5"    stroke="var(--muted)"    gradient={{      from: "var(--muted)",      via: "var(--muted)",      to: "var(--muted)",      fromOpacity: 0,      viaOpacity: 1,      toOpacity: 0,    }}  />  <HeatmapXAxis />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend align="center" gap={3} />

Trending up by 5.2% this month

Heatmap Chart - Loading

Skeleton grid with cell shimmer while data loads (six months)

import { HeatmapChartLoading } from "@bklitui/ui/charts";<HeatmapChartLoading  data={data}  gap={3}  label="Loading contributions"/>

Trending up by 5.2% this month

Heatmap Chart - Horizontal Scroll

Scroll a full year of contributions with a viewport sized to six months

<HeatmapInteractionProvider>  <HeatmapInteractionBoundary>    <div className="flex w-full min-w-0">      <div className="relative shrink-0" style={{ width: yAxisWidth }}>        {/* Mon / Wed / Fri labels aligned to row bins */}      </div>      <div className="scroll-fade-x no-scrollbar min-w-0 flex-1 overflow-x-auto">        <div style={{ width: `${(data.length / 26) * 100}%` }}>          <HeatmapChart            data={data}            gap={3}            layout="fluid"            margin={{ top: 28, right: 12, bottom: 0, left: 0 }}          >            <HeatmapCells />            <HeatmapXAxis />            <HeatmapTooltip />          </HeatmapChart>        </div>      </div>    </div>    <HeatmapLegend align="center" gap={3} />  </HeatmapInteractionBoundary></HeatmapInteractionProvider>

Trending up by 5.2% this month

Heatmap Chart - Gradient Legend

Continuous gradient bar legend with custom endpoint labels (six months)

<HeatmapChart data={data} gap={3} layout="fluid" levelStyles={levelStyles}>  <HeatmapCells />  <HeatmapXAxis />  <HeatmapYAxis tickFilter="odd" labelFormat="initial" />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend  align="center"  variant="gradient"  lessLabel="Faster"  moreLabel="Slower"  fontSize={12}  labelClassName="text-muted-foreground"  levelStyles={levelStyles}  gap={3}/>

Trending up by 5.2% this month

Heatmap Chart - Monday Start

Week starts on Monday with M–S labels and faded weekend rows (six months)

import { buildHeatmapRowOpacity } from "@bklitui/ui/charts";const weekendOpacity = buildHeatmapRowOpacity((row) => row >= 5, 0.35);<HeatmapChart data={data} gap={3} layout="fluid" weekStartDay={1}>  <HeatmapCells rowOpacity={weekendOpacity} />  <HeatmapXAxis />  <HeatmapYAxis    tickFilter="all"    labelFormat="initial"    rowOpacity={weekendOpacity}  />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend align="center" gap={3} />

Trending up by 5.2% this month

Heatmap Chart - Active Scale Hover

Enlarge the hovered cell with a slightly larger gap (six months)

<HeatmapChart data={data} gap={4} layout="fluid">  <HeatmapCells    activeScale={1.1}    inactiveOpacity={0.45}    inactiveScale={1}  />  <HeatmapXAxis />  <HeatmapYAxis tickFilter="odd" labelFormat="initial" />  <HeatmapTooltip /></HeatmapChart><HeatmapLegend  align="center"  gap={4}  activeScale={1.1}  inactiveOpacity={0.45}  inactiveScale={1}/>

Trending up by 5.2% this month