Components
Metric
A number with its context, change and a small trend line.
pnpm dlx shadcn@latest add @caliper/metricActive users
+12%
24,180
Last 30 days
Paid seats
+4.6%
3,912
Across 380 workspaces
Trials started
+9%
640
Since 1 October
When to use
Use it for
- Headline figures at the top of a dashboard.
- A value that needs a short history beside it.
Skip it when
- Detailed comparison; use a chart.
- Only a label and a number; use a stat card.
Installation
pnpm dlx shadcn@latest add @caliper/metric
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
import { Metric } from "@/components/ui/metric" export function ActiveUsers() { return ( <div className="grid w-full max-w-3xl gap-3 sm:grid-cols-3"> <Metric className="shadow-resting" label="Active users" value="24,180" context="Last 30 days" change="+12%" series={[12, 14, 13, 18, 17, 21, 24]} /> <Metric className="shadow-resting" label="Paid seats" value="3,912" context="Across 380 workspaces" change="+4.6%" series={[30, 31, 31, 33, 34, 36, 37]} /> <Metric className="shadow-resting" label="Trials started" value="640" context="Since 1 October" change="+9%" series={[18, 21, 19, 24, 22, 27, 29]} /> </div> ); }
API reference
Metric
component
Also accepts the native props of its root element and a ref.
Accessibility
It is built on native elements, so roles and focus come from the browser.
No custom key handling; Tab and the native activation keys do the work.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.