# Stats grid

A responsive four-card metric grid for consumer-owned values, comparisons, and detail links.

Access: pro. Category: Marketing. Kind: composite.

## When to use

- Use it when a page needs a responsive four-card metric grid for consumer-owned values, comparisons, and detail links.
- Choose it as the social-proof region when composing a page from independently reusable TidalUI sections.

## Alternatives

- Choose feature-card instead when a feature summary with animated orbital artwork is the actual interface need, rather than stats grid.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Stats grid

```sh
npx shadcn@latest add @tidal-pro/stats-grid
```

Stylesheets: `components/ui/tidal.css`, `components/ui/stats-grid.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/stats-grid.css";
import{TidalStatsGrid}from"./components/ui/stats-grid";
export default()=><div className="tidal-scope"><TidalStatsGrid metrics={[{id:"example",label:"Demo",value:"value"}]} title={"Demo"}/></div>;
```

## Structured props

- `TidalStatsGrid.metrics: ReadonlyArray<TidalStatsGridMetric>`: Required metrics value accepted by this exported component.
- `TidalStatsGrid.title: ReactNode`: Required title value accepted by this exported component.
- `TidalStatsGrid.action?: TidalStatsGridLink | undefined`: Optional action value accepted by this exported component.
- `TidalStatsGrid.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalStatsGrid.emptyMessage?: ReactNode` (default "No metrics to display."): Optional empty message value accepted by this exported component.
- `TidalStatsGrid.eyebrow?: ReactNode` (default "Stats"): Optional eyebrow value accepted by this exported component.
- `TidalStatsGrid.headingLevel?: TidalStatsGridHeadingLevel | undefined` (default "h2"): Optional heading level value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/stats-grid.tsx) | [Manifest](https://tidalui.com/examples/stats-grid.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState } from "react";

import { RotateCcw } from "lucide-react";

import { TidalStatsGrid, type TidalStatsGridMetric } from "./components/ui/stats-grid";

import "./components/ui/stats-grid.css";



const tidalExampleStyles = ".tidal-scope .stats-grid-demo {\n  width: 100%;\n  max-width: 1160px;\n  min-width: 0;\n  overflow: hidden;\n  border: 1px solid var(--t-border);\n  border-radius: 22px;\n  background: var(--t-subtle);\n  color: var(--t-ink);\n  box-shadow: 0 30px 66px -46px #00000070;\n  container-type: inline-size;\n}\n\n.tidal-scope .stats-grid-demo,\n.tidal-scope .stats-grid-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .stats-grid-demo-layout {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n  min-width: 0;\n}\n\n\n.tidal-scope .stats-grid-demo-stage-head,\n.tidal-scope .stats-grid-demo-table-head {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 14px;\n  min-width: 0;\n}\n\n.tidal-scope .stats-grid-demo-kicker {\n  display: block;\n  color: var(--t-muted);\n  font-size: 11px;\n  font-weight: 650;\n  letter-spacing: 0.12em;\n  line-height: 1.4;\n  text-transform: uppercase;\n}\n\n.tidal-scope .stats-grid-demo-stage {\n  display: grid;\n  min-width: 0;\n  gap: 20px;\n  padding: 27px;\n  background:\n    linear-gradient(var(--t-border) 1px, transparent 1px),\n    linear-gradient(90deg, var(--t-border) 1px, transparent 1px),\n    var(--t-subtle);\n  background-size: 22px 22px;\n}\n\n.tidal-scope .stats-grid-demo-stage-head {\n  align-items: flex-start;\n}\n\n.tidal-scope .stats-grid-demo-table-head > div {\n  min-width: 0;\n}\n\n.tidal-scope .stats-grid-demo-stage-head p {\n  max-width: 530px;\n  margin: 5px 0 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .stats-grid-demo-stage-head button,\n.tidal-scope .stats-grid-demo-periods button {\n  display: inline-flex;\n  min-width: 44px;\n  min-height: 44px;\n  align-items: center;\n  justify-content: center;\n  gap: 7px;\n  padding: 8px 12px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 11px;\n  font-weight: 650;\n  cursor: pointer;\n  transition:\n    background 160ms,\n    border-color 160ms,\n    transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .stats-grid-demo-stage-head button {\n  flex: none;\n}\n\n.tidal-scope .stats-grid-demo-stage-head button:hover,\n.tidal-scope .stats-grid-demo-periods button:hover {\n  background: var(--t-wash);\n}\n\n.tidal-scope .stats-grid-demo-stage-head button:active,\n.tidal-scope .stats-grid-demo-periods button:active {\n  transform: scale(0.98);\n}\n\n.tidal-scope .stats-grid-demo-stage-head button:focus-visible,\n.tidal-scope .stats-grid-demo-periods button:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n.tidal-scope .stats-grid-demo-periods {\n  display: grid;\n  grid-template-columns: repeat(3, minmax(0, 1fr));\n  gap: 7px;\n  min-width: 0;\n}\n\n.tidal-scope .stats-grid-demo-periods button {\n  min-width: 0;\n}\n\n.tidal-scope .stats-grid-demo-periods button[aria-pressed=\"true\"] {\n  border-color: var(--t-ink);\n  background: var(--t-ink);\n  color: var(--t-surface);\n}\n\n.tidal-scope .stats-grid-demo-table-wrap {\n  min-width: 0;\n  padding: 21px 22px 19px;\n  border: 1px solid var(--t-border);\n  border-radius: 18px;\n  background: var(--t-surface);\n}\n\n.tidal-scope .stats-grid-demo-table-head {\n  align-items: end;\n  padding-bottom: 16px;\n  border-bottom: 1px solid var(--t-border);\n}\n\n.tidal-scope .stats-grid-demo-table-head h3 {\n  margin: 7px 0 0;\n  font-size: 20px;\n  font-weight: 500;\n  letter-spacing: -0.04em;\n  line-height: 1.05;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .stats-grid-demo-table-note {\n  max-width: 190px;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.45;\n  text-align: end;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .stats-grid-demo-table-scroll {\n  min-width: 0;\n  overflow-x: auto;\n}\n\n.tidal-scope .stats-grid-demo-table-scroll table {\n  width: 100%;\n  min-width: 0;\n  table-layout: fixed;\n  border-collapse: collapse;\n  color: var(--t-ink);\n  font-size: 11px;\n  text-align: start;\n}\n\n.tidal-scope .stats-grid-demo-table-scroll th,\n.tidal-scope .stats-grid-demo-table-scroll td {\n  padding: 13px 10px;\n  border-bottom: 1px solid var(--t-border);\n  text-align: start;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .stats-grid-demo-table-scroll thead th {\n  color: var(--t-muted);\n  font-size: 11px;\n  font-weight: 650;\n  letter-spacing: 0.1em;\n  text-transform: uppercase;\n}\n\n.tidal-scope .stats-grid-demo-table-scroll tbody th {\n  font-weight: 650;\n}\n\n.tidal-scope .stats-grid-demo-table-scroll tr:last-child > * {\n  border-bottom: 0;\n}\n\n.tidal-scope .stats-grid-demo-disclosure {\n  margin: 15px 0 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.55;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .stats-grid-demo-visually-hidden {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  padding: 0;\n  overflow: hidden;\n  border: 0;\n  clip: rect(0 0 0 0);\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n\n@container (max-width: 760px) {\n  .tidal-scope .stats-grid-demo-layout {\n    grid-template-columns: minmax(0, 1fr);\n  }\n}\n\n@container (max-width: 500px) {\n  .tidal-scope .stats-grid-demo-stage {\n    gap: 15px;\n    padding: 14px;\n    background-size: 18px 18px;\n  }\n\n  .tidal-scope .stats-grid-demo-stage-head {\n    display: block;\n  }\n\n  .tidal-scope .stats-grid-demo-stage-head button {\n    width: 100%;\n    margin-top: 12px;\n  }\n\n  .tidal-scope .stats-grid-demo-periods {\n    grid-template-columns: minmax(0, 1fr);\n  }\n\n  .tidal-scope .stats-grid-demo-table-wrap {\n    padding: 18px 16px 16px;\n  }\n\n  .tidal-scope .stats-grid-demo-table-head {\n    align-items: flex-start;\n    flex-direction: column;\n    gap: 8px;\n  }\n\n  .tidal-scope .stats-grid-demo-table-note {\n    max-width: none;\n    text-align: start;\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .stats-grid-demo-stage-head button,\n  .tidal-scope .stats-grid-demo-periods button {\n    transition: none;\n    transform: none;\n  }\n}";

type PeriodId = "current" | "previous" | "baseline";

interface PeriodData {
  label: string;
  note: string;
  metrics: readonly TidalStatsGridMetric[];
  rows: readonly [string, string, string][];
}

const PERIODS: Record<PeriodId, PeriodData> = {
  current: {
    label: "Current month",
    note: "Sample workspace / current month",
    metrics: [
      {
        id: "active-work",
        label: "Active work",
        value: "28",
        comparison: "+6 sample items",
        detail: "Open items across three fictional lanes.",
        trend: "positive",
        valueKey: "current-active",
        href: "#stats-grid-demo-table",
      },
      {
        id: "review-ready",
        label: "Review ready",
        value: "12",
        comparison: "4 awaiting a read",
        detail: "Prepared items in the local review queue.",
        trend: "neutral",
        valueKey: "current-review",
      },
      {
        id: "planned-hours",
        label: "Planned hours",
        value: "86h",
        comparison: "+14h in sample plan",
        detail: "A display value supplied by the workspace owner.",
        trend: "positive",
        valueKey: "current-hours",
      },
      {
        id: "open-questions",
        label: "Open questions",
        value: "07",
        comparison: "2 marked urgent",
        detail: "Questions still visible in the local handoff list.",
        trend: "negative",
        valueKey: "current-questions",
      },
    ],
    rows: [
      ["Planning", "In review", "Ava"],
      ["Build", "On track", "Noah"],
      ["Handoff", "2 questions", "Mila"],
    ],
  },
  previous: {
    label: "Previous month",
    note: "Sample workspace / previous month",
    metrics: [
      {
        id: "active-work",
        label: "Active work",
        value: "22",
        comparison: "5 sample items",
        detail: "Open items in the previous local snapshot.",
        trend: "neutral",
        valueKey: "previous-active",
        href: "#stats-grid-demo-table",
      },
      {
        id: "review-ready",
        label: "Review ready",
        value: "08",
        comparison: "3 awaiting a read",
        detail: "Prepared items in the previous sample queue.",
        trend: "neutral",
        valueKey: "previous-review",
      },
      {
        id: "planned-hours",
        label: "Planned hours",
        value: "72h",
        comparison: "9h in sample plan",
        detail: "The earlier display value supplied by the workspace owner.",
        trend: "neutral",
        valueKey: "previous-hours",
      },
      {
        id: "open-questions",
        label: "Open questions",
        value: "09",
        comparison: "3 marked urgent",
        detail: "Questions visible in the previous local handoff list.",
        trend: "negative",
        valueKey: "previous-questions",
      },
    ],
    rows: [
      ["Planning", "Draft", "Ava"],
      ["Build", "In progress", "Noah"],
      ["Handoff", "3 questions", "Mila"],
    ],
  },
  baseline: {
    label: "Baseline snapshot",
    note: "Sample workspace / baseline snapshot",
    metrics: [
      {
        id: "active-work",
        label: "Active work",
        value: "18",
        comparison: "Baseline sample",
        detail: "A fixed local comparison snapshot.",
        trend: "neutral",
        valueKey: "baseline-active",
        href: "#stats-grid-demo-table",
      },
      {
        id: "review-ready",
        label: "Review ready",
        value: "06",
        comparison: "Baseline sample",
        detail: "A fixed local comparison snapshot.",
        trend: "neutral",
        valueKey: "baseline-review",
      },
      {
        id: "planned-hours",
        label: "Planned hours",
        value: "64h",
        comparison: "Baseline sample",
        detail: "A fixed local comparison snapshot.",
        trend: "neutral",
        valueKey: "baseline-hours",
      },
      {
        id: "open-questions",
        label: "Open questions",
        value: "11",
        comparison: "Baseline sample",
        detail: "A fixed local comparison snapshot.",
        trend: "neutral",
        valueKey: "baseline-questions",
      },
    ],
    rows: [
      ["Planning", "Open", "Ava"],
      ["Build", "Not started", "Noah"],
      ["Handoff", "4 questions", "Mila"],
    ],
  },
};

const PERIOD_OPTIONS: readonly { id: PeriodId; label: string }[] = [
  { id: "current", label: "Current" },
  { id: "previous", label: "Previous" },
  { id: "baseline", label: "Baseline" },
];

export function StatsGridDemo() {
  const [period, setPeriod] = useState<PeriodId>("current");
  const [message, setMessage] = useState("Current month sample selected.");
  const active = PERIODS[period];

  function choosePeriod(next: PeriodId) {
    setPeriod(next);
    setMessage(`${PERIODS[next].label} sample selected.`);
  }

  function resetSample() {
    setPeriod("current");
    setMessage("Current month sample restored.");
  }

  return (
    <section className="stats-grid-demo" aria-label="Stats grid preview">
      <div className="stats-grid-demo-layout">
        <div className="stats-grid-demo-stage">
          <div className="stats-grid-demo-stage-head">
            <p>{active.note}. Switching updates the cards and detail table.</p>
            <button type="button" onClick={resetSample}>
              <RotateCcw size={14} aria-hidden="true" />
              Reset
            </button>
          </div>

          <div
            className="stats-grid-demo-periods"
            role="group"
            aria-label="Sample period"
          >
            {PERIOD_OPTIONS.map((option) => (
              <button
                key={option.id}
                type="button"
                aria-pressed={period === option.id}
                onClick={() => choosePeriod(option.id)}
              >
                {option.label}
              </button>
            ))}
          </div>

          <TidalStatsGrid
            eyebrow="Sample workspace"
            title="Workspace overview"
            description="Every value below is explicit local sample content. Consumers provide the metric meaning, comparison text, and any destination."
            metrics={active.metrics}
            action={{
              label: "View sample ledger",
              href: "#stats-grid-demo-table",
            }}
          />

          <div
            className="stats-grid-demo-table-wrap"
            id="stats-grid-demo-table"
          >
            <div className="stats-grid-demo-table-head">
              <div>
                <span className="stats-grid-demo-kicker">DETAIL TABLE</span>
                <h3>{active.label} lanes</h3>
              </div>
              <span
                className="stats-grid-demo-table-note"
                role="status"
                aria-live="polite"
              >
                {message}
              </span>
            </div>
            <div className="stats-grid-demo-table-scroll">
              <table>
                <caption className="stats-grid-demo-visually-hidden">
                  {active.label} fictional sample workspace lanes
                </caption>
                <thead>
                  <tr>
                    <th scope="col">Lane</th>
                    <th scope="col">State</th>
                    <th scope="col">Owner</th>
                  </tr>
                </thead>
                <tbody>
                  {active.rows.map(([lane, state, owner]) => (
                    <tr key={lane}>
                      <th scope="row">{lane}</th>
                      <td>{state}</td>
                      <td>{owner}</td>
                    </tr>
                  ))}
                </tbody>
              </table>
            </div>
            <p className="stats-grid-demo-disclosure">
              Fictional sample values for local component review only. This
              preview makes no customer, adoption, performance, revenue, or
              live-data claim.
            </p>
          </div>
        </div>
      </div>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <StatsGridDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

title and metrics are required. Each metric has a stable id, consumer-owned ReactNode label/value, optional comparison/detail/trend and valueKey for a finite visual transition. Supplied trend choices render independently of comparison copy and receive a readable word and distinct marker in addition to color. Optional ReactNode slots use nullish presence checks, preserving values such as numeric zero. Optional metric href/linkProps/ref render native anchors when href is present, including an explicit empty string; metrics without href remain noninteractive articles. Optional action forwards native anchor attributes/ref. The root forwards native section attributes/ref, uses a collision-safe generated heading id, derives safe metric label semantics from headingLevel, and supports description, eyebrow, headingLevel and arbitrary emptyMessage content. Values are displayed exactly as supplied; the component performs no aggregation, formatting, fetching, storage, analytics or adoption claim. Reduced motion removes value transitions and native links retain 44px-plus targets.
