A row of status squares for uptime, job runs or habits; hover a square (or use the arrow keys) to read its day and note. Where it's narrow, the oldest make room.
$ pnpm dlx shadcn@latest add @dashral/trackerInstallation
$ pnpm dlx shadcn@latest add @dashral/trackerAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/tracker.json
When to use
- How something went, one square per day or run: uptime, a job's runs, a habit.
When not to use
- Amounts per day over months: Heatmap.
- A trend in numbers: Sparkline or Line Chart.
Usage
Each square's label, its color for what it means, and a note to read on hover.
import { Tracker } from "@/components/dashral/tracker"
const days = [
{ label: "Nov 8", note: "No incidents" },
{ label: "Nov 9", color: "warning", note: "Slow responses for 14 minutes" },
{ label: "Nov 10", note: "No incidents" },
] as const
export default function ApiUptime() {
return <Tracker data={[...days]} summary="99.98% uptime" endLabel="Today" aria-label="API uptime" />
}Using the npm package? Import from @dashral/ui/components/tracker instead, here and in the examples; the rest is the same.
Examples
API reference
Tracker
Also takes every prop of <div>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
data | { key?, label, color?, note? }[]The squares, oldest first. label is what one stands for (a day, a run); color what it means (success, warning, destructive, info, primary, or neutral for no data); note what happened. Required. | — |
color | "success" | "warning" | "destructive" | "info" | "primary" | "neutral"The color of squares without their own. | "success" |
height | numberThe squares' height in pixels. | 28 |
startLabel / summary / endLabel | ReactNodeUnder the row while no square is read; null leaves one out. The start follows the oldest square showing. | the first and last square's labels / — |
aria-label | stringWhat it shows, e.g. “API uptime, last 90 days”. | — |
classNames | { square, caption } | — |
Keyboard
| Keys | Action |
|---|---|
| Tab | Focus the row |
| ←or→ | Read the previous or next square |
| HomeorEnd | The first or last square |
| Esc | Stop reading |
Accessibility
- A group named by your label; the square you move to with the arrow keys is read out (its label and note).
- Colors are never alone: every square's label and note can be read, by hover or by keyboard.
- Right to left, the oldest square is on the right and the arrows follow what you see.
Motion
- The squares rise in one after another when it first shows; reading one fades the others back, and the line under the row crossfades to it. Still with reduced motion.