Heatmap
8starlabs-ui/heatmap-demoFreeExample
A heatmap demo component
Install it
npx shadcn@latest add https://ui.8starlabs.com/r/heatmap-demo.jsonSource
1import Heatmap, {2 type HeatmapData3} from "@/registry/8starlabs-ui/blocks/heatmap";4import { useMemo } from "react";56function generateRandomHeatmapData(7 startDate: Date,8 endDate: Date,9 minValue: number = 0,10 maxValue: number = 3011): HeatmapData {12 const data: HeatmapData = [];13 const current = new Date(startDate);1415 while (current <= endDate) {16 const dateString = current.toISOString().slice(0, 10);17 const value =18 Math.floor(Math.random() * (maxValue - minValue + 1)) + minValue;19 data.push({ date: dateString, value });20 current.setDate(current.getDate() + 1);21 }2223 return data;24}2526export default function HeatmapDemo() {27 const data = useMemo(28 () =>29 generateRandomHeatmapData(30 new Date("2025-01-01"),31 new Date("2025-06-30"),32 0,33 3034 ),35 []36 );3738 return (39 <Heatmap40 data={data}41 startDate={new Date("2025-01-01")}42 endDate={new Date("2025-06-30")}43 colorMode="interpolate"44 />45 );46}
Files it writes
More from 8starlabs-ui
All 74 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Buttonbutton-demo | 8starlabs-ui | Examples | Free | no deps | |
| Flip clockflip-clock-countdown-demo | 8starlabs-ui | Examples | Free | no deps | |
| Flip clockflip-clock-demo | 8starlabs-ui | Examples | Free | no deps | |
| Flip clockflip-clock-showdays-demo | 8starlabs-ui | Examples | Free | no deps | |
| Flip clockflip-clock-size-demo | 8starlabs-ui | Examples | Free | no deps | |
| Flip clockflip-clock-variants-demo | 8starlabs-ui | Examples | Free | no deps | |
| Heatmapheatmap-custom-colors-demo | 8starlabs-ui | Examples | Free | no deps | |
| Heatmapheatmap-custom-display-demo | 8starlabs-ui | Examples | Free | no deps |
