Blocks · Marketing
Stats row
A section header and three or four figures in a row, each a large value over its label; a description list with tabular numerals.
26% of 289 about pages and 20% of 671 home pages we studied have a stats section.
In numbers
Fast, and boring in the good way
- median time from push to live
- 42 s
- uptime over the last twelve months
- 99.98%
- teams deploying every week
- 1,200+
- regions, with more on the way
- 3
In numbers
Fast, and boring in the good way
- median time from push to live
- 42 s
- uptime over the last twelve months
- 99.98%
- teams deploying every week
- 1,200+
- regions, with more on the way
- 3
Both previews render the same markup; the HTML tab below is that markup without a framework.
Install
- React
- npx shadcn@
latest add https:// www.themes.dev/ ui/ r/ stats-row.json - Astro
- npx shadcn@
latest add https:// www.themes.dev/ ui/ r/ astro/ stats-row.json
Or copy the files below into your project. They need clsx, tailwind-merge and the components they import, and the themes.dev UI theme. The HTML needs only the compiled CSS.
/** Stats row: a section header and three or four figures in one row, each a large value over its label, with a rule
* above it (figures are data, and data keeps its lines). A description list: the label is the term and comes first in
* the DOM, the value is shown above it with flex-col-reverse. Two across on a phone, the full row from 48rem. Figures
* use tabular numerals so a row of them lines up. */
export const statsRow = {
root: '@container bg-background px-6 py-16 text-foreground @3xl:py-24',
inner: 'mx-auto flex max-w-6xl flex-col gap-12',
list: (count: number) => ['m-0 grid grid-cols-2 gap-x-6 gap-y-10', count === 3 ? '@3xl:grid-cols-3' : '@3xl:grid-cols-4', '@3xl:gap-x-10'].join(' '),
stat: 'flex min-w-0 flex-col-reverse justify-end gap-2 border-t pt-5',
// 30px on a narrow block so a value like 99.98% fits its half of a phone row; 36px from 24rem, 48px from 48rem.
value: 'm-0 text-3xl font-semibold tracking-[-0.04em] tabular-nums @sm:text-4xl @3xl:text-5xl',
label: 'text-base text-pretty text-muted-foreground',
};
export type Stat = { value: string; label: string };
export type StatsRowContent = {
kicker?: string;
title: string;
description?: string;
stats: Stat[];
/** Unique on the page; ids the heading. */
id: string;
};import { SectionHeader } from '@/components/ui/section-header';
import { cn } from '@/lib/utils';
import { statsRow as c, type StatsRowContent } from './stats-row.classes';
export type StatsRowProps = StatsRowContent & { className?: string };
/** A section header and three or four figures in a row, each a large value over its label. */
export function StatsRow({ kicker, title, description, stats, id, className }: StatsRowProps) {
return (
<section aria-labelledby={`${id}-title`} className={cn(c.root, className)}>
<div className={c.inner}>
<SectionHeader id={`${id}-title`} kicker={kicker} title={title} description={description} />
<dl className={c.list(stats.length)}>
{stats.map((s) => (
<div key={s.label} className={c.stat}>
<dt className={c.label}>{s.label}</dt>
<dd className={c.value}>{s.value}</dd>
</div>
))}
</dl>
</div>
</section>
);
}---
import SectionHeader from '@/components/ui/section-header.astro';
import { cn } from '@/lib/utils';
import { statsRow as c, type StatsRowContent } from './stats-row.classes';
type Props = StatsRowContent & { class?: string };
const { kicker, title, description, stats, id, class: className } = Astro.props;
---
<section aria-labelledby={`${id}-title`} class={cn(c.root, className)}>
<div class={c.inner}>
<SectionHeader id={`${id}-title`} kicker={kicker} title={title} description={description} />
<dl class={c.list(stats.length)}>
{
stats.map((s) => (
<div class={c.stat}>
<dt class={c.label}>{s.label}</dt>
<dd class={c.value}>{s.value}</dd>
</div>
))
}
</dl>
</div>
</section>/** Stats row: a section header and three or four figures in one row, each a large value over its label, with a rule
* above it (figures are data, and data keeps its lines). A description list: the label is the term and comes first in
* the DOM, the value is shown above it with flex-col-reverse. Two across on a phone, the full row from 48rem. Figures
* use tabular numerals so a row of them lines up. */
export const statsRow = {
root: '@container bg-background px-6 py-16 text-foreground @3xl:py-24',
inner: 'mx-auto flex max-w-6xl flex-col gap-12',
list: (count: number) => ['m-0 grid grid-cols-2 gap-x-6 gap-y-10', count === 3 ? '@3xl:grid-cols-3' : '@3xl:grid-cols-4', '@3xl:gap-x-10'].join(' '),
stat: 'flex min-w-0 flex-col-reverse justify-end gap-2 border-t pt-5',
// 30px on a narrow block so a value like 99.98% fits its half of a phone row; 36px from 24rem, 48px from 48rem.
value: 'm-0 text-3xl font-semibold tracking-[-0.04em] tabular-nums @sm:text-4xl @3xl:text-5xl',
label: 'text-base text-pretty text-muted-foreground',
};
export type Stat = { value: string; label: string };
export type StatsRowContent = {
kicker?: string;
title: string;
description?: string;
stats: Stat[];
/** Unique on the page; ids the heading. */
id: string;
};<section aria-labelledby="ex-stats-title" class="@container bg-background px-6 py-16 text-foreground @3xl:py-24">
<div class="mx-auto flex max-w-6xl flex-col gap-12">
<header class="@container w-full">
<div class="flex flex-wrap items-end justify-between gap-x-8 gap-y-4">
<div class="min-w-0 grow basis-[24rem]">
<p class="text-sm font-medium text-muted-foreground">In numbers</p>
<h2 id="ex-stats-title" class="mt-2 text-3xl font-semibold tracking-[-0.03em] text-balance @xl:text-4xl">Fast, and boring in the good way</h2>
</div>
</div>
</header>
<dl class="m-0 grid grid-cols-2 gap-x-6 gap-y-10 @3xl:grid-cols-4 @3xl:gap-x-10">
<div class="flex min-w-0 flex-col-reverse justify-end gap-2 border-t pt-5">
<dt class="text-base text-pretty text-muted-foreground">median time from push to live</dt>
<dd class="m-0 text-3xl font-semibold tracking-[-0.04em] tabular-nums @sm:text-4xl @3xl:text-5xl">42 s</dd>
</div>
<div class="flex min-w-0 flex-col-reverse justify-end gap-2 border-t pt-5">
<dt class="text-base text-pretty text-muted-foreground">uptime over the last twelve months</dt>
<dd class="m-0 text-3xl font-semibold tracking-[-0.04em] tabular-nums @sm:text-4xl @3xl:text-5xl">99.98%</dd>
</div>
<div class="flex min-w-0 flex-col-reverse justify-end gap-2 border-t pt-5">
<dt class="text-base text-pretty text-muted-foreground">teams deploying every week</dt>
<dd class="m-0 text-3xl font-semibold tracking-[-0.04em] tabular-nums @sm:text-4xl @3xl:text-5xl">1,200+</dd>
</div>
<div class="flex min-w-0 flex-col-reverse justify-end gap-2 border-t pt-5">
<dt class="text-base text-pretty text-muted-foreground">regions, with more on the way</dt>
<dd class="m-0 text-3xl font-semibold tracking-[-0.04em] tabular-nums @sm:text-4xl @3xl:text-5xl">3</dd>
</div>
</dl>
</div>
</section>