Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Dashboard cards
Heatmap Chart Card
A heatmap whose headline follows the cell under the pointer.
import { HeatmapChartCard } from "@/registry/vcare/ui/heatmap-chart-card"
const columns = Array.from({ length: 12 }, (_, i) => `${8 + i}`)
const rows = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat"].map((label, r) => ({
label,
values: columns.map((_, c) => Math.max(0, 18 - Math.abs(c - 3) * 2 + ((r * 5 + c * 3) % 7))),
}))
export default function HeatmapChartCardDemo() {
return <HeatmapChartCard className="w-full" label="Busiest hours" rows={rows} columns={columns} unit="visits" />
}Installation
npx shadcn@latest add @vcare/heatmap-chart-cardOr install directly from the URL: https://ui.vcarehms.com/r/heatmap-chart-card.json
- Add the registry items it uses: heatmap-chart, insight-card, period-tabs.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/heatmap-chart-card.tsx
import { useState } from 'react';
import { InsightCard } from '@/registry/vcare/ui/insight-card';
import { HeatmapChart, type HeatmapCell, type HeatmapChartProps } from '@/registry/vcare/ui/heatmap-chart';
import { PeriodTabs, type PeriodOption } from '@/registry/vcare/ui/period-tabs';
interface Props extends Pick<HeatmapChartProps, 'rows' | 'columns' | 'color' | 'unit' | 'valueFormatter' | 'columnLabelEvery' | 'levels'> {
label?: string;
periods?: PeriodOption[];
period?: string;
onPeriodChange?: (period: string) => void;
className?: string;
}
/** A heatmap whose headline follows the cell under the pointer, so the number and the cell it came from are always together. */
export function HeatmapChartCard({
label,
periods,
period,
onPeriodChange,
className,
valueFormatter = (v) => v.toLocaleString(),
unit,
...chart
}: Props) {
const [cell, setCell] = useState<HeatmapCell | null>(null);
const hovered = cell ? chart.rows[cell.row]?.values[cell.column] : undefined;
const total = chart.rows.reduce((s, r) => s + r.values.reduce((a, b) => a + b, 0), 0);
return (
<InsightCard
className={className}
label={cell ? `${chart.rows[cell.row]?.label} · ${chart.columns[cell.column]}` : label}
value={valueFormatter(hovered ?? total)}
unit={unit}
action={periods ? <PeriodTabs options={periods} value={period} onValueChange={onPeriodChange} animated /> : undefined}
>
<HeatmapChart {...chart} unit={unit} valueFormatter={valueFormatter} activeCell={cell} onActiveCellChange={setCell} />
</InsightCard>
);
}Usage
import { HeatmapChartCard } from "@/components/ui/heatmap-chart-card"Exports
HeatmapChartCard
Dependencies
@vcare/heatmap-chart(registry)@vcare/insight-card(registry)@vcare/period-tabs(registry)
Raw item: /r/heatmap-chart-card.json