Hairline Stats Band
A four-up metrics strip with 1px hairline dividers, built from a single gap-px grid so the rules stay crisp on any display.
Metrics carrying the direction they moved, with the good direction declared per stat so a falling churn rate reads as a win — arrow and text, never colour alone.
components/stats-cards.tsxnpx hoverlab add stats-cards
Or over MCP, from your editor's agent — no account needed.
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Start a page with this section — add more, order them, and leave with the page source.
Monthly recurring revenue
vs. previous 30 days
Active workspaces
vs. previous 30 days
Churn
Lower is better
Median response time
vs. previous 30 days
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
/**
* <StatsCards> — metrics with the direction they moved.
*
* <StatsBand> states magnitude: four numbers, hairline-separated, the shape
* a landing page uses to say how big something is. This one answers a
* different question — whether it is getting better — which is the one an
* investor update, a status page or a dashboard header is actually asked.
*
* A number with no baseline is not evidence. "1.2M requests" could be a
* record or a collapse, and the reader has no way to tell, so the delta is
* a required part of a `Stat` here rather than an optional flourish.
*
* Direction is never carried by colour alone. Each delta pairs its tint
* with an arrow that points, and with a `sr-only` word, so the meaning
* survives a monochrome print, a red-green colour deficiency and a screen
* reader — three readers for whom a green number is just a number.
*
* `intent` is separate from the sign for the case that catches people out:
* churn falling is good and error rate rising is bad. Tying the tint to the
* arithmetic would paint those backwards, so the author says which
* direction is the good one and the block colours from that.
*/
import * as React from 'react'
import { ArrowDownRight, ArrowUpRight, Minus } from 'lucide-react'
export interface StatCard {
label: string
value: string
/** Change against the previous period, e.g. '+12.4%'. */
delta: string
/** Which way is good. 'up' suits revenue; 'down' suits churn. */
intent?: 'up' | 'down' | 'neutral'
caption?: string
}
export interface StatsCardsProps {
stats?: StatCard[]
heading?: string
subheading?: string
/** Period the deltas are measured against, named once for all of them. */
periodLabel?: string
className?: string
}
const DEFAULT_STATS: StatCard[] = [
{ label: 'Monthly recurring revenue', value: '$48.2k', delta: '+12.4%', intent: 'up' },
{ label: 'Active workspaces', value: '1,284', delta: '+3.1%', intent: 'up' },
{
label: 'Churn',
value: '1.8%',
delta: '−0.4pt',
intent: 'down',
caption: 'Lower is better',
},
{ label: 'Median response time', value: '142ms', delta: '0.0%', intent: 'neutral' },
]
/** Whether a delta reads as good, bad or flat, given what the author called good. */
function toneOf(delta: string, intent: StatCard['intent']) {
const moved = delta.trim().replace(/^[+\-−]?0(\.0+)?(%|pt|ms)?$/i, '')
if (intent === 'neutral' || moved === '') {
return {
klass: 'text-muted-foreground',
Icon: Minus,
word: 'No change',
}
}
// A leading minus in any of its typographic forms. Everything else —
// including a bare "12%" — is treated as an increase.
const fell = /^[-−]/.test(delta.trim())
const good = intent === 'down' ? fell : !fell
return {
klass: good ? 'text-emerald-600 dark:text-emerald-400' : 'text-red-600 dark:text-red-400',
Icon: fell ? ArrowDownRight : ArrowUpRight,
word: fell ? 'Down' : 'Up',
}
}
export function StatsCards({
stats = DEFAULT_STATS,
heading = 'How the quarter is going',
subheading,
periodLabel = 'vs. previous 30 days',
className = '',
}: StatsCardsProps) {
return (
<section
className={`mx-auto w-full max-w-6xl px-4 py-16 sm:px-6 ${className}`}
>
{heading ? (
<div className="mb-8 max-w-2xl">
<h2 className="text-balance text-2xl font-bold tracking-tight sm:text-3xl">
{heading}
</h2>
{subheading ? (
<p className="mt-2 text-muted-foreground">{subheading}</p>
) : null}
</div>
) : null}
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
{stats.map((stat) => {
const { klass, Icon, word } = toneOf(stat.delta, stat.intent)
return (
<div
key={stat.label}
className="min-w-0 rounded-2xl border border-border/60 bg-card/60 p-5"
>
<p className="break-words text-sm text-muted-foreground">{stat.label}</p>
<div className="mt-2 flex flex-wrap items-baseline gap-2">
<span className="break-words text-3xl font-extrabold tracking-tight tabular-nums">
{stat.value}
</span>
<span
className={`inline-flex items-center gap-0.5 text-sm font-medium tabular-nums ${klass}`}
>
<Icon aria-hidden className="h-3.5 w-3.5" />
{/* The direction as a word, for every reader who is not
being served by the tint or the arrow. */}
<span className="sr-only">{word} </span>
{stat.delta}
</span>
</div>
<p className="mt-1 break-words text-xs text-muted-foreground">
{stat.caption ?? periodLabel}
</p>
</div>
)
})}
</div>
</section>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/stats-cards.tsx and import it where you need the section:
import { StatsCards } from '@/components/stats-cards'2 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.
Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.
| Prop | Type | Default |
|---|---|---|
stats | StatCard[] | DEFAULT_STATS |
heading | string | 'How the quarter is going' |
subheading | string | — |
periodLabelPeriod the deltas are measured against, named once for all of them. | string | 'vs. previous 30 days' |
className | string | '' |
The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.
<!--
Stat Cards with Deltas — markup from the Hoverlab catalog.
This is the block rendered once to HTML and wrapped as a component
file. It is not a port of the React source: the Tailwind classes carry
the design, which is the part that took the work, and they are the same
in every framework.
This block has no interactive behaviour, so nothing is missing.
-->
<section class="mx-auto w-full max-w-6xl px-4 py-16 sm:px-6 ">
<div class="mb-8 max-w-2xl">
<h2 class="text-balance text-2xl font-bold tracking-tight sm:text-3xl">How the quarter is going</h2>
</div>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
<div class="min-w-0 rounded-2xl border border-border/60 bg-card/60 p-5">
<p class="break-words text-sm text-muted-foreground">Monthly recurring revenue</p>
<div class="mt-2 flex flex-wrap items-baseline gap-2">
<span class="break-words text-3xl font-extrabold tracking-tight tabular-nums">$48.2k</span>
<span class="inline-flex items-center gap-0.5 text-sm font-medium tabular-nums text-emerald-600 dark:text-emerald-400"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right h-3.5 w-3.5" aria-hidden="true"><path d="M7 7h10v10"></path><path d="M7 17 17 7"></path></svg><span class="sr-only">Up </span>+12.4%</span>
</div>
<p class="mt-1 break-words text-xs text-muted-foreground">vs. previous 30 days</p>
</div>
<div class="min-w-0 rounded-2xl border border-border/60 bg-card/60 p-5">
<p class="break-words text-sm text-muted-foreground">Active workspaces</p>
<div class="mt-2 flex flex-wrap items-baseline gap-2">
<span class="break-words text-3xl font-extrabold tracking-tight tabular-nums">1,284</span>
<span class="inline-flex items-center gap-0.5 text-sm font-medium tabular-nums text-emerald-600 dark:text-emerald-400"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right h-3.5 w-3.5" aria-hidden="true"><path d="M7 7h10v10"></path><path d="M7 17 17 7"></path></svg><span class="sr-only">Up </span>+3.1%</span>
</div>
<p class="mt-1 break-words text-xs text-muted-foreground">vs. previous 30 days</p>
</div>
<div class="min-w-0 rounded-2xl border border-border/60 bg-card/60 p-5">
<p class="break-words text-sm text-muted-foreground">Churn</p>
<div class="mt-2 flex flex-wrap items-baseline gap-2">
<span class="break-words text-3xl font-extrabold tracking-tight tabular-nums">1.8%</span>
<span class="inline-flex items-center gap-0.5 text-sm font-medium tabular-nums text-emerald-600 dark:text-emerald-400"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-right h-3.5 w-3.5" aria-hidden="true"><path d="m7 7 10 10"></path><path d="M17 7v10H7"></path></svg><span class="sr-only">Down </span>−0.4pt</span>
</div>
<p class="mt-1 break-words text-xs text-muted-foreground">Lower is better</p>
</div>
<div class="min-w-0 rounded-2xl border border-border/60 bg-card/60 p-5">
<p class="break-words text-sm text-muted-foreground">Median response time</p>
<div class="mt-2 flex flex-wrap items-baseline gap-2">
<span class="break-words text-3xl font-extrabold tracking-tight tabular-nums">142ms</span>
<span class="inline-flex items-center gap-0.5 text-sm font-medium tabular-nums text-muted-foreground"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-minus h-3.5 w-3.5" aria-hidden="true"><path d="M5 12h14"></path></svg><span class="sr-only">No change </span>0.0%</span>
</div>
<p class="mt-1 break-words text-xs text-muted-foreground">vs. previous 30 days</p>
</div>
</div>
</section>
What each framework gets across the whole catalog — effects convert properly; this rung is markup.
The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.
Want the whole screen instead of this one section? Open a page and copy it entire.
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse StatsCopying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
A four-up metrics strip with 1px hairline dividers, built from a single gap-px grid so the rules stay crisp on any display.
Four figures in a hairline card next to the paragraph making the claim, each carrying an optional source line — for numbers that mean nothing without knowing lower than what, over how long, across how many.
The buyer’s current situation in one column and yours in the next, as a real table with scoped headers — the comparison they are actually making, which a delta against your own past cannot express.
The same measurement taken year after year down a vertical rail, each with the event that explains it — the shape for trajectory, which no snapshot of four numbers can claim.
Performance figures with the measurement method printed beside each one, so a sceptical reader can check rather than take them.
The compliance and security facts a procurement reviewer asks for, stated as figures with their scope rather than as badges.