Stats: four metrics with hairline dividers
Heading and caption over four large metrics separated by hairlines, two by two on mobile and in one row from lg.
pnpm dlx shadcn@latest add @haze/stats-row---
interface Props {
title?: string;
description?: string;
stats?: { value: string; label: string }[];
}
const {
title = "Built for teams that ship every week",
description = "Numbers from the last twelve months across all workspaces.",
stats = [
{ value: "12,400+", label: "teams on Driftwork" },
{ value: "38%", label: "faster cycle time on average" },
{ value: "99.99%", label: "uptime over the past year" },
{ value: "4.9/5", label: "average rating from 2,100 reviews" },
],
} = Astro.props;
---
<section aria-labelledby="stats-row-title" class="bg-background px-6 py-20 sm:py-24">
<div class="mx-auto max-w-6xl">
<div class="max-w-2xl">
<h2 id="stats-row-title" class="text-3xl/9 font-semibold tracking-tight text-balance text-foreground sm:text-4xl/11">{title}</h2>
<p class="mt-4 text-base/7 text-pretty text-muted-foreground">{description}</p>
</div>
<dl class="mt-12 grid grid-cols-2 gap-px overflow-hidden border-y border-border bg-border lg:grid-cols-4 lg:gap-0 lg:divide-x lg:divide-border lg:bg-transparent">
{
stats.map((stat) => (
<div class="flex flex-col-reverse justify-end gap-2 bg-background px-3 py-8 sm:px-6 lg:py-10 lg:first:pl-0 lg:last:pr-6">
<dt class="text-sm/6 text-muted-foreground">{stat.label}</dt>
<dd class="text-3xl/9 font-semibold tracking-tight text-foreground sm:text-4xl/10 tabular-nums">{stat.value}</dd>
</div>
))
}
</dl>
</div>
</section>When to use
- You have three or four hard numbers that prove traction
- Between features and testimonials on a landing page
When not to use
- The numbers need charts or trends to make sense; use a chart-based stats block
Installation
Add the Haze registry to components.json once, then install Stats: four metrics with hairline dividers with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/stats-rownpx shadcn@latest add @haze/stats-rowyarn dlx shadcn@latest add @haze/stats-rowbunx --bun shadcn@latest add @haze/stats-rowFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | demo heading | Section heading (h2). |
| description | string | demo caption | Caption that dates or qualifies the numbers. |
| stats | { value: string; label: string }[] | 4 demo stats | Metric value and its label. |
Accessibility
- Metrics use a description list (dl/dt/dd), so each value is announced with its label.
- The hairline grid expects a count that fills its rows: a multiple of 2, and of 4 from lg.
- The label is visually below the value but comes first in the DOM, so screen readers read it as label then value.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
Install and use
Install the Haze UI block "Stats: four metrics with hairline dividers" with `npx shadcn@latest add @haze/stats-row`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import StatsRow from "@/components/haze/blocks/stats-row.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/stats-row.md
Customize with real content
Adapt the Haze stats-row block for our product. Replace the demo values of these props with our real content: title, description, stats. Keep the layout, the heading level rules and these accessibility details: Metrics use a description list (dl/dt/dd), so each value is announced with its label. The hairline grid expects a count that fills its rows: a multiple of 2, and of 4 from lg. The label is visually below the value but comes first in the DOM, so screen readers read it as label then value. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using stats-row, check it fits: use it when you have three or four hard numbers that prove traction; between features and testimonials on a landing page. Avoid it when the numbers need charts or trends to make sense; use a chart-based stats block. Alternatives: @haze/logos-row.
Dependencies
- @haze/theme (one-time setup)
Source · Original Haze UI work.