Skip to content
OTF Kit logoOTF Kit

Activity Heatmap

Data

GitHub-style yearly activity contribution grid with hover tooltips.

View in Storybook
Activity Heatmap
Loading Storybook preview…

Installation

bun add @otfdashkit/ui

Usage

Import Activity Heatmap from @otfdashkit/ui.

Code
// Activity Heatmap — GitHub-style yearly activity contribution grid with hover tooltips.
//
// Install:
//   bun add @otfdashkit/ui

import { ActivityHeatmap } from '@otfdashkit/ui'

export function Example() {
  return (
    <ActivityHeatmap>
      {/* your content */}
    </ActivityHeatmap>
  )
}

Props

Props declared in the ActivityHeatmap source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
datarequiredHeatmapDay[]Daily values for the heatmap
totalrequiredstring | numberThe big number above the heatmap (e.g. total events)
captionstring'Activity'Caption above the total — e.g. "Activity"
cellSizenumber11Cell size in px. Default 11.
centeredbooleantrueCenter the heatmap horizontally inside its scroll container. Default true.
classNamestring
colorScalestring[]Optional 5-step color scale. Defaults to primary opacity ramp.
endDateDateDate the heatmap should end on. Defaults to today.
filterValuestring
filtersFilterOption[]Optional filter — renders a ToggleGroup at the top right
formatTooltip(day: HeatmapDay) => stringTooltip formatter passed to Heatmap
gapnumber3Gap between cells in px. Default 3.
onFilterChange(value: string) => void
statsSummaryStat[]4 summary stats shown below the heatmap (e.g. Most Active Month / Day / Longest / Current Streak)
weeksnumber53Number of week columns. Default 53.

Related