Activity heatmap
Activity heatmap where each day is nine sub-pixels, so intensity shows as brightness and density; switching metric flips cells in a wave.
Demo data
The daily activity counts are generated from each date; nothing can be set. It cannot show your own data yet, so use it as a template: replace the invented data in its source before it shows anything real. See Your data.
Installation
pnpm dlx shadcn@latest add @lumesec/px-activityFirst timeRegister the @lumesec registry once, or install by URL
Adds @lumesec to your components.json:
pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/px-activity.jsonUsage
import { PxActivity } from "@/components/lumesec/px-activity";
export function Example() {
return (
<PxActivity />
);
}Behaviour
Every day is a cell made of nine sub-pixels, so intensity shows as both brightness and density. Hovering draws a crosshair and a tooltip; clicking sends a ripple across the months; switching metric flips the cells in a diagonal wave.
API reference
Methods
Call them on the element, for example through a React ref.
setMetric(index: 0 | 1)Switches the metric: 0 for sessions, 1 for tokens. Other values are ignored.
Keyboard
| Keys | Action |
|---|---|
| ArrowLeft / ArrowRight / ArrowUp / ArrowDown | In the metric switch: select and focus the other metric. |
Accessibility
- The metric switch is a
role="radiogroup"witharia-label="Metric"; its two buttons haverole="radio"andaria-checked. Only the checked radio is in the tab order; arrow keys move the selection. - The canvas has
role="img"with anaria-labelgiving the total and the longest streak for the current metric. - The streak summary above the grid is an
aria-live="polite"region. - The per-day tooltip appears on pointer hover only.
- Reduced motion: switching metric replaces the cells at once instead of flipping them in a diagonal wave; click ripples still play.
Theming
The element reads your shadcn theme tokens through its shadow root, so light and dark follow your theme. The accent comes from --lumesec. See Theming.
This component reads --card, --foreground, --lumesec, --muted and --muted-foreground.
To restyle only LumeSec elements, set the matching --ui-* overrides: --ui-accent, --ui-fg, --ui-muted, --ui-surface and --ui-track.
Notes
- The data is generated demo data, derived deterministically from each date, with weekdays busier than weekends. There is no attribute for real data.
- The grid ends at today and shows one 12px column per week, from 8 to 40 weeks depending on width. The canvas is 86px tall.
Related
Was this page helpful?