Examples
Calendar heatmap Pro
Days as shaded squares, a week per column, as GitHub draws contributions: commits, workouts, sales, habits. Rows take a date (a Date or 'YYYY-MM-DD', read as a local day) and a value; days without a row are empty. Shades step from faint to the full color by each day's share of the busiest. On a narrow screen the chart shows the latest weeks that fit at a size a finger can hit.
import { HeatmapChart } from '@patine-ui/pro';
Live data
Loading…
<View style={{ width: 600, maxWidth: '100%', gap: 8 }}> <View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}> <Text>{day ? `${day.row.value ?? 0} commits on ${day.row.date.toDateString()}` : 'Hover or press a day'}</Text> <Button size="sm" variant="outline" onPress={() => setData(roll())}>Shuffle</Button> </View> <HeatmapChart data={data} valueLabel="Commits" onPointSelect={setDay} accessibilityLabel="Commits, last six months" /> </View>
Try the props
levelsweekStartsOncellSizedesign<HeatmapChart data={days} valueLabel="Commits" />
Example: a year of workouts
A fitness app's year: each square is a day, darker for longer workouts, so streaks and gaps show at a glance. Press a day for its details.
Loading…
<View style={{ width: '100%', gap: 8 }}> <Text>{day ? `${day.row.value ? `${day.row.value} min` : 'Rest day'} on ${day.row.date.toDateString()}` : `${total} workouts in 2026`}</Text> <HeatmapChart data={data} valueLabel="Minutes" color="#16A34A" levels={4} weekStartsOn={1} onPointSelect={setDay} accessibilityLabel="Workout minutes each day of 2026" /> </View>
Colors and weeks
Loading…
<HeatmapChart data={data} color="#7C3AED" levels={6} weekStartsOn={1} valueLabel="Workouts" style={{ width: 420 }} />
Props
The shared chart props (its height follows its width), and:
| Prop | Type | Default | Description |
|---|---|---|---|
data | { date, value }[] | — | One row per day; rows for the same day add up. |
dateKey / valueKey | string | 'date' / 'value' | |
valueLabel | string | 'Value' | What the value counts, in the tooltip and summary. |
startDate / endDate | Date | the data's | The span shown. |
weekStartsOn | number | 0 | 0 is Sunday, 1 Monday. |
color | string | the theme's primary | The darkest shade. |
levels | number | 4 | Shades for days with a value. |
cellSize | number | 16 | The largest a day may grow, in px. |
showMonthLabels / showWeekdayLabels / showScale | boolean | true |