MenuClose

Block Stats — React Page Block

Stats band where every number counts up from zero on scroll-in, with a settled, screen-reader-friendly final value always present. Prefixes, suffixes and formatting are props.

View source
PreviewReact
Starting live preview

Usage

import { BlockStats } from "@/components/BlockStats";

export function Numbers() {
  return (
    <BlockStats
      title="The graph, measured."
      stats={[
        { value: 128, suffix: "ms", label: "Median deploy window" },
        { value: 99.98, decimals: 2, suffix: "%", label: "Rollouts clean" },
      ]}
      {...{
        title: "The graph, measured.",
        accent: "#d5ed9a",
        scheme: "dark"
      }}
    />
  );
}
Implementation notes & API

Purpose: stats/metrics band with count-up. Copy it, ship it — every string, link and color arrives through props. Runtime: pure DOM + CSS. No WebGPU, canvas, animation library or external assets; SSR-safe on first render. Theming: root custom properties (--vb-bg, --vb-fg, --vb-accent, --vb-border, --vb-radius, --vb-container) or the accent/scheme/className/style props. scheme flips the dark default to light. Guardrails: responsive via container queries down to 320px; interactive behavior degrades on touch; prefers-reduced-motion drops entrance/scroll motion while content stays complete. Numbers render settled for SSR and no-JS; the count-up re-arms once in view. Reduced motion shows final figures immediately.

PropertyTypeNotes / default
eyebrow / title / descriptionReactNodeSection header; all three optional for a bare band
statsreadonly StatItem[]{ value, decimals?, prefix?, suffix?, label, description?, format? }
demoNoteReactNode | nullFictional-figures marker; pass null with real data
scheme"dark" | "light"dark
accentstring (hex)Sets --vb-accent for the whole block
className / stylestring / CSSPropertiesApplied to the section root
childrenReactNodeReplaces the default content entirely
View source on GitHubFree for commercial projects · MIT