<!-- generated by scripts/gen-docs.mjs from docs/system/result-count.md. Edit the source and rerun. -->
# ResultCount

## Description
Says how many items match a list: the exact count, an estimate, a floor while the end is not known yet, or how many of them can be shown when the server caps it, and reads each new count to a screen reader.

`import { ResultCount, type ResultCountLabels, type ResultCountPrecision, type ResultCountProps } from "@/components/cobalt/ui/result-count"`, source `registry/cobalt/ui/result-count.tsx`, status `ready`.
Foundation: `hand-rolled`. Traps checked: `trap/numbers-shift`, `trap/loading-layout-shift`, `trap/live-region-double`, `trap/color-only-status`, `trap/text-measure`, `trap/reduced-motion-ignored`.

`trap/numbers-shift` is answered by tabular figures and the line's one-line floor, so a count that gains a digit moves nothing beside it. `trap/loading-layout-shift` by the bar the width of a count that holds the line while it is unknown (States). `trap/live-region-double` by the one polite status on the root and none inside it (Accessibility). `trap/color-only-status` by the words: a pending count is dimmed and busy, and the words still say the last count. `trap/text-measure` by words that wrap rather than cut (Limits). `trap/reduced-motion-ignored` by the dim, an opacity fade kept under reduce (Motion).

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| Not applicable: hand-rolled, a `p` | One line of `text-sm` muted figures in tabular widths: "1,284 funds", "About 12,400 funds", "At least 200 funds", "Showing the first 500 of 12,400 funds", with the noun plural through `plural` from `registry/cobalt/lib/format.ts`; a polite `role="status"`, so each new count is read once (`registry/cobalt/ui/result-count.tsx:95`); while the count is unknown a 7em `Skeleton` line holds its place and the line is `aria-busy`; a count being worked out again stays on screen, busy, and dims to 55 percent once the wait passes the slow-wait delay (`useSlowWait`), as the rows below it do; a failure with no count leaves the line empty at its one-line height; `children` after the words, such as the link that lifts a cap; `labels` for every sentence, so a translation orders the words its own way; the Fund Census count line, "Showing the first {n} results" and its allowance copy, as one part (`docs/research/2026-10-17-fund-census-states.md`, section 5, item 7) |

## Examples
The count above a list follows its filter: a bar holds its place on the first load, a screen reader hears each new count, and the count dims with the rows while the next answer loads.

Real uses, 0 call sites (`rg -n "<ResultCount\b" app registry --glob '!registry/cobalt/ui/*'`): the part is new. The data table's examples use it above their rows (`docs/system/examples/data-table/windowed.tsx`, `docs/system/examples/data-table/block-failed.tsx`, `docs/system/examples/data-table/filtered-empty.tsx`), and the examples folder does not count.

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/result-count/default.tsx` | default | The count above a list follows its filter: a bar holds its place on the first load, a screen reader hears each new count, and the count dims with the rows while the next answer loads |
| Not applicable: default.tsx counts exactly, the default | precision=exact | "1,284 funds" |
| `docs/system/examples/result-count/approximate.tsx` | precision=approximate | A full-text search estimates how many filings match rather than counting them, so the count says about |
| `docs/system/examples/result-count/partial.tsx` | precision=partial | A list paged by cursor knows only how many it has seen and that more follow, so the count says at least that many until the last page comes back |
| `docs/system/examples/result-count/capped.tsx` | state:capped | The server matches 12,400 funds but hands out the first 500 before sign-in, so the count says so with the way to lift the cap, and the line after the last row says the list ends there, with the same way on |
| Not applicable: default.tsx opens on its first load | state:unknown | A bar the width of a count |
| Not applicable: default.tsx dims while a new strategy loads | state:pending | The last count, dimmed after 250ms |
| Not applicable: default.tsx fails while the address has ?network=offline | state:failure | The line empty at its height |
| `docs/system/examples/result-count/default.tsx` | composition:DataTable | The count beside a segmented filter over the table it counts |

Example: The count above a list follows its filter: a bar holds its place on the first load, a screen reader hears each new count, and the count dims with the rows while the next answer loads (`docs/system/examples/result-count/default.tsx`)

```tsx
import { useCallback, useEffect, useRef, useState } from "react";

import { type Column, DataTable } from "@/components/cobalt/ui/data-table";
import { ResultCount } from "@/components/cobalt/ui/result-count";
import { SegmentedControl, type Segment } from "@/components/cobalt/ui/segmented-control";
import { compactMoney, digitsFor, unitFor } from "@/lib/cobalt/format";
import type { Status } from "@/lib/cobalt/status";

type Strategy = "all" | "equity" | "credit";
type Fund = { id: number; fund: string; adviser: string; strategy: Exclude<Strategy, "all">; assets: number };

const strategies: readonly Segment<Strategy>[] = [
  { value: "all", label: "All funds" },
  { value: "equity", label: "Equity" },
  { value: "credit", label: "Credit" },
];
// Inert sample data: invented advisers and their funds, computed from the index so the list reads
// the same on every visit, largest first.
const houses = [
  "Harbour",
  "Calder",
  "Northgate",
  "Kestrel",
  "Larkspur",
  "Wexley",
  "Aldmoor",
  "Brightwater",
  "Halden",
  "Corran",
  "Ashbury",
  "Redfern",
  "Marlow",
  "Elmstead",
  "Pryor Dean",
  "Hollis Crane",
  "Whitlock",
  "Ravensworth",
  "Oakhurst",
  "Tamsin",
];
const equity = ["Global Equity", "Large Cap Core", "Small Cap Value", "Emerging Markets", "Dividend Growth", "International Equity", "Mid Cap Growth"];
const credit = ["Credit Opportunities", "Short Duration", "High Yield", "Municipal Income", "Investment Grade", "Floating Rate"];
const forms = ["Fund", "Fund II", "Portfolio", "Trust", "Fund III", "Strategies"];

const funds: Fund[] = Array.from({ length: 1_284 }, (_, i) => {
  const house = houses[(i * 7 + Math.floor(i / 20)) % houses.length]!;
  const lines = i % 3 === 0 ? credit : equity;
  return {
    id: i + 1,
    fund: `${house} ${lines[(i * 5 + Math.floor(i / 7)) % lines.length]} ${forms[(i * 3 + Math.floor(i / 11)) % forms.length]}`,
    adviser: `${house} Capital`,
    strategy: i % 3 === 0 ? "credit" : "equity",
    // From $42B for the largest, falling fast at the top and slowly in the long tail, to about $140M.
    assets: Math.round(42_000_000_000 * (1 + i) ** -0.8),
  };
});

// One unit and one precision for the whole column, so the figures line up.
const unit = unitFor(funds.map((f) => f.assets));
const digits = digitsFor(
  funds.map((f) => f.assets),
  unit,
);
const columns: Column<Fund>[] = [
  { key: "fund", label: "Fund", kind: "text" },
  // On a phone the adviser fills the line under the fund's name, beside the figure.
  { key: "adviser", label: "Adviser", kind: "text" },
  {
    key: "assets",
    label: "Gross assets",
    kind: "number",
    cell: (row) => compactMoney(row.assets, unit, "en-US", "USD", { digits }),
  },
];

// Stands in for your API call. It answers after 900ms, and fails while the browser is offline or the
// address has ?network=offline.
const request = (strategy: Strategy) =>
  new Promise<Fund[]>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve(strategy === "all" ? funds : funds.filter((fund) => fund.strategy === strategy));
    }, 900),
  );

export default function Example() {
  const [strategy, setStrategy] = useState<Strategy>("all");
  const [rows, setRows] = useState<Fund[]>([]);
  const [status, setStatus] = useState<Status>("pending");
  const latest = useRef(0);
  const load = useCallback((next: Strategy) => {
    setStrategy(next);
    setStatus("pending");
    const id = ++latest.current;
    request(next).then(
      (answer) => {
        if (id !== latest.current) return;
        setRows(answer);
        setStatus("success");
      },
      () => {
        if (id === latest.current) setStatus("failure");
      },
    );
  }, []);
  useEffect(() => load("all"), [load]);
  return (
    <div className="flex w-full flex-col gap-3">
      <SegmentedControl label="Strategy" value={strategy} options={strategies} onChange={load} />
      {/* On its own line, so a count that gains a digit never pushes the filter onto another one.
          Unknown until the first answer lands; kept, dimmed, while the next one loads. */}
      <ResultCount
        count={rows.length > 0 || status === "success" ? rows.length : undefined}
        noun={{ one: "fund", other: "funds" }}
        status={status}
      />
      <div className="overflow-hidden rounded-2xl bg-card">
        <DataTable
          label="Funds"
          labels={{ notLoaded: "The funds did not load" }}
          columns={columns}
          rows={rows}
          getRowId={(row) => row.id}
          status={status}
          onRetry={() => load(strategy)}
          maxRows={6}
          phoneMain="fund"
          phoneCount={false}
        />
      </div>
    </div>
  );
}
```

Example: The count beside a segmented filter over the table it counts (`docs/system/examples/result-count/default.tsx`)

```tsx
import { useCallback, useEffect, useRef, useState } from "react";

import { type Column, DataTable } from "@/components/cobalt/ui/data-table";
import { ResultCount } from "@/components/cobalt/ui/result-count";
import { SegmentedControl, type Segment } from "@/components/cobalt/ui/segmented-control";
import { compactMoney, digitsFor, unitFor } from "@/lib/cobalt/format";
import type { Status } from "@/lib/cobalt/status";

type Strategy = "all" | "equity" | "credit";
type Fund = { id: number; fund: string; adviser: string; strategy: Exclude<Strategy, "all">; assets: number };

const strategies: readonly Segment<Strategy>[] = [
  { value: "all", label: "All funds" },
  { value: "equity", label: "Equity" },
  { value: "credit", label: "Credit" },
];
// Inert sample data: invented advisers and their funds, computed from the index so the list reads
// the same on every visit, largest first.
const houses = [
  "Harbour",
  "Calder",
  "Northgate",
  "Kestrel",
  "Larkspur",
  "Wexley",
  "Aldmoor",
  "Brightwater",
  "Halden",
  "Corran",
  "Ashbury",
  "Redfern",
  "Marlow",
  "Elmstead",
  "Pryor Dean",
  "Hollis Crane",
  "Whitlock",
  "Ravensworth",
  "Oakhurst",
  "Tamsin",
];
const equity = ["Global Equity", "Large Cap Core", "Small Cap Value", "Emerging Markets", "Dividend Growth", "International Equity", "Mid Cap Growth"];
const credit = ["Credit Opportunities", "Short Duration", "High Yield", "Municipal Income", "Investment Grade", "Floating Rate"];
const forms = ["Fund", "Fund II", "Portfolio", "Trust", "Fund III", "Strategies"];

const funds: Fund[] = Array.from({ length: 1_284 }, (_, i) => {
  const house = houses[(i * 7 + Math.floor(i / 20)) % houses.length]!;
  const lines = i % 3 === 0 ? credit : equity;
  return {
    id: i + 1,
    fund: `${house} ${lines[(i * 5 + Math.floor(i / 7)) % lines.length]} ${forms[(i * 3 + Math.floor(i / 11)) % forms.length]}`,
    adviser: `${house} Capital`,
    strategy: i % 3 === 0 ? "credit" : "equity",
    // From $42B for the largest, falling fast at the top and slowly in the long tail, to about $140M.
    assets: Math.round(42_000_000_000 * (1 + i) ** -0.8),
  };
});

// One unit and one precision for the whole column, so the figures line up.
const unit = unitFor(funds.map((f) => f.assets));
const digits = digitsFor(
  funds.map((f) => f.assets),
  unit,
);
const columns: Column<Fund>[] = [
  { key: "fund", label: "Fund", kind: "text" },
  // On a phone the adviser fills the line under the fund's name, beside the figure.
  { key: "adviser", label: "Adviser", kind: "text" },
  {
    key: "assets",
    label: "Gross assets",
    kind: "number",
    cell: (row) => compactMoney(row.assets, unit, "en-US", "USD", { digits }),
  },
];

// Stands in for your API call. It answers after 900ms, and fails while the browser is offline or the
// address has ?network=offline.
const request = (strategy: Strategy) =>
  new Promise<Fund[]>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve(strategy === "all" ? funds : funds.filter((fund) => fund.strategy === strategy));
    }, 900),
  );

export default function Example() {
  const [strategy, setStrategy] = useState<Strategy>("all");
  const [rows, setRows] = useState<Fund[]>([]);
  const [status, setStatus] = useState<Status>("pending");
  const latest = useRef(0);
  const load = useCallback((next: Strategy) => {
    setStrategy(next);
    setStatus("pending");
    const id = ++latest.current;
    request(next).then(
      (answer) => {
        if (id !== latest.current) return;
        setRows(answer);
        setStatus("success");
      },
      () => {
        if (id === latest.current) setStatus("failure");
      },
    );
  }, []);
  useEffect(() => load("all"), [load]);
  return (
    <div className="flex w-full flex-col gap-3">
      <SegmentedControl label="Strategy" value={strategy} options={strategies} onChange={load} />
      {/* On its own line, so a count that gains a digit never pushes the filter onto another one.
          Unknown until the first answer lands; kept, dimmed, while the next one loads. */}
      <ResultCount
        count={rows.length > 0 || status === "success" ? rows.length : undefined}
        noun={{ one: "fund", other: "funds" }}
        status={status}
      />
      <div className="overflow-hidden rounded-2xl bg-card">
        <DataTable
          label="Funds"
          labels={{ notLoaded: "The funds did not load" }}
          columns={columns}
          rows={rows}
          getRowId={(row) => row.id}
          status={status}
          onRetry={() => load(strategy)}
          maxRows={6}
          phoneMain="fund"
          phoneCount={false}
        />
      </div>
    </div>
  );
}
```

## Variants

### precision
- `exact` (default): the server counted every match. Used at 0 call sites; the default example and the data table's examples use it.
- `approximate`: the server estimated the count, such as a search engine's hit count. "About 12,400 funds". Used at 0 call sites; the approximate example uses it.
- `partial`: the count is a floor, such as the items a cursor list has handed out so far, or a count the server stopped at. "At least 200 funds". Used at 0 call sites; the partial example uses it.

Example: A full-text search estimates how many filings match rather than counting them, so the count says about (`docs/system/examples/result-count/approximate.tsx`)

```tsx
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/cobalt/ui/item";
import { ResultCount } from "@/components/cobalt/ui/result-count";
import { date } from "@/lib/cobalt/format";

const hits = [
  { id: "a1", adviser: "Harbour Capital Advisors", form: "Form ADV, Part 2A", filed: "2026-10-14" },
  { id: "a2", adviser: "Calder & Rowe", form: "Form ADV, Part 2A", filed: "2026-10-09" },
  { id: "a3", adviser: "Northgate Investment", form: "Form ADV, Part 2B", filed: "2026-09-30" },
];

export default function Example() {
  return (
    <section aria-label="Search results" className="flex w-full max-w-lg flex-col gap-3">
      {/* The search engine's own estimate, rounded by it; the count says about rather than a figure it cannot vouch for. */}
      <ResultCount count={12_400} precision="approximate" noun={{ one: "filing", other: "filings" }} />
      <ItemGroup variant="card" render={<ul aria-label="Filings that mention custody" />}>
        {hits.map((hit) => (
          <Item key={hit.id} render={<li />}>
            <ItemContent>
              <ItemTitle>{hit.adviser}</ItemTitle>
              <ItemDescription>{hit.form}</ItemDescription>
            </ItemContent>
            <ItemActions>
              <time dateTime={hit.filed}>{date(hit.filed)}</time>
            </ItemActions>
          </Item>
        ))}
      </ItemGroup>
    </section>
  );
}
```

Example: A list paged by cursor knows only how many it has seen and that more follow, so the count says at least that many until the last page comes back (`docs/system/examples/result-count/partial.tsx`)

```tsx
import { useRef, useState } from "react";

import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/cobalt/ui/item";
import { ListBody } from "@/components/cobalt/ui/list-body";
import { Pagination } from "@/components/cobalt/ui/pagination";
import { ResultCount } from "@/components/cobalt/ui/result-count";
import { date } from "@/lib/cobalt/format";
import { useSlowWait } from "@/lib/cobalt/use-slow-wait";

const PAGE_SIZE = 4;
const advisers = ["Harbour Capital Advisors", "Calder & Rowe", "Northgate Investment", "Fjord Asset Management"];
const forms = ["Form ADV", "Form 13F", "Form PF"];
// 10 filings, one a day going back from 16 October. The server never says how many.
const filings = Array.from({ length: 10 }, (_, i) => ({
  id: `filing-${i + 1}`,
  adviser: advisers[i % advisers.length] ?? "",
  form: forms[i % forms.length] ?? "",
  filed: new Date(Date.UTC(2026, 9, 16 - i)).toISOString().slice(0, 10),
}));

// Stands in for your API: the page after a cursor, and whether another follows. It answers after 700ms.
const request = (after: number) =>
  new Promise<{ rows: typeof filings; more: boolean }>((resolve) =>
    setTimeout(() => resolve({ rows: filings.slice(after, after + PAGE_SIZE), more: after + PAGE_SIZE < filings.length }), 700),
  );

export default function Example() {
  const [page, setPage] = useState(1);
  const [shown, setShown] = useState({ page: 1, rows: filings.slice(0, PAGE_SIZE), more: true });
  // How many filings the pages seen so far hold: a floor while more follow, the count once none do.
  const [seen, setSeen] = useState(PAGE_SIZE);
  const latest = useRef(0);
  const dimmed = useSlowWait(page !== shown.page);
  const go = (next: number) => {
    setPage(next);
    const ticket = ++latest.current;
    request((next - 1) * PAGE_SIZE).then((answer) => {
      if (ticket !== latest.current) return;
      setShown({ page: next, rows: answer.rows, more: answer.more });
      setSeen((was) => Math.max(was, (next - 1) * PAGE_SIZE + answer.rows.length));
    });
  };
  const empty = PAGE_SIZE - shown.rows.length;
  const done = !shown.more && shown.page === page;
  return (
    <section aria-label="Filings" className="flex w-full max-w-lg flex-col gap-3">
      <ResultCount count={seen} precision={done || seen === filings.length ? "exact" : "partial"} noun={{ one: "filing", other: "filings" }} />
      <ListBody busy={dimmed}>
        <ItemGroup variant="card" render={<ul aria-label="Filings" />}>
          {shown.rows.map((filing) => (
            <Item key={filing.id} render={<li />}>
              <ItemContent>
                <ItemTitle>{filing.adviser}</ItemTitle>
                <ItemDescription>{filing.form}</ItemDescription>
              </ItemContent>
              <ItemActions>
                <time dateTime={filing.filed}>{date(filing.filed)}</time>
              </ItemActions>
            </Item>
          ))}
          {Array.from({ length: empty }, (_, i) => (
            <Item key={`empty-${i}`} render={<li aria-hidden="true" className="invisible" />}>
              <ItemContent>
                <ItemTitle>
                  <span>&nbsp;</span>
                </ItemTitle>
                <ItemDescription>
                  <span>&nbsp;</span>
                </ItemDescription>
              </ItemContent>
            </Item>
          ))}
        </ItemGroup>
      </ListBody>
      <Pagination
        page={page}
        showing={shown.page}
        pageSize={PAGE_SIZE}
        hasMore={shown.more || page > shown.page}
        pageItems={shown.rows.length}
        hideSummary
        onPageChange={go}
      />
    </section>
  );
}
```

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| known | `count` is a number | read it | the words, in tabular figures | test |
| unknown | `count` is undefined and `status` is not failure | wait | a 7em bar one line tall, `aria-busy`; the words take its place in the same line, so nothing moves | test |
| pending | `status="pending"` with a count | read the last count | `aria-busy` at once; the line at 55 percent after the 250ms slow-wait delay, at least 400ms, fading back over `--t-fade` | test |
| capped | `available` below `count` | follow the link in `children` | "Showing the first 500 of 12,400 funds", the precision's word inside it ("of about 12,400"), and the host's link after the words | test |
| failure | `status="failure"` with no count | retry where the list says what failed | the line empty at its one-line height; a link in `children` waits for words | test |

Example: The server matches 12,400 funds but hands out the first 500 before sign-in, so the count says so with the way to lift the cap, and the line after the last row says the list ends there, with the same way on (`docs/system/examples/result-count/capped.tsx`)

```tsx
import { type Column, DataTable } from "@/components/cobalt/ui/data-table";
import { ResultCount } from "@/components/cobalt/ui/result-count";
import { TextLink } from "@/components/cobalt/ui/text-link";
import { compactMoney } from "@/lib/cobalt/format";
import { useRowWindow } from "@/lib/cobalt/row-window";

type Fund = { id: number; fund: string; adviser: string; assets: number };

const TOTAL = 12_400;
const ALLOWED = 500;
// Inert sample data: invented advisers and their funds, computed from the index so the list reads
// the same on every visit, largest first.
const houses = [
  "Harbour",
  "Calder",
  "Northgate",
  "Kestrel",
  "Larkspur",
  "Wexley",
  "Aldmoor",
  "Brightwater",
  "Halden",
  "Corran",
  "Ashbury",
  "Redfern",
  "Marlow",
  "Elmstead",
  "Pryor Dean",
  "Hollis Crane",
  "Whitlock",
  "Ravensworth",
  "Oakhurst",
  "Tamsin",
];
const lines = ["Global Equity", "Credit Opportunities", "Short Duration", "Large Cap Core", "High Yield", "Municipal Income", "Dividend Growth", "Emerging Markets"];
const forms = ["Fund", "Fund II", "Portfolio", "Trust", "Fund III", "Strategies"];

const fundAt = (i: number): Fund => {
  const house = houses[(i * 7 + Math.floor(i / 20)) % houses.length]!;
  return {
    id: i + 1,
    fund: `${house} ${lines[(i * 5 + Math.floor(i / 7)) % lines.length]} ${forms[(i * 3 + Math.floor(i / 11)) % forms.length]}`,
    adviser: `${house} Capital`,
    // The 500 largest of 12,400: from $42B, falling fast at the top, to about $1.9B.
    assets: Math.round(42_000_000_000 * (1 + i) ** -0.5),
  };
};

// Stands in for your API: one block after 600ms, with every match counted and only the first 500
// handed out.
const fetchPage = (start: number, count: number, signal: AbortSignal) =>
  new Promise<{ rows: { id: number; fund: string; adviser: string; assets: number }[]; total: number; available: number }>(
    (resolve) => {
      const timer = setTimeout(() => {
        const end = Math.min(start + count, ALLOWED);
        resolve({ rows: Array.from({ length: Math.max(0, end - start) }, (_, k) => fundAt(start + k)), total: TOTAL, available: ALLOWED });
      }, 600);
      signal.addEventListener("abort", () => clearTimeout(timer));
    },
  );

const columns: Column<Fund>[] = [
  { key: "fund", label: "Fund", kind: "text" },
  // On a phone the adviser fills the line under the fund's name, beside the figure.
  { key: "adviser", label: "Adviser", kind: "text" },
  // One unit and one precision for the whole column, so the figures line up.
  { key: "assets", label: "Gross assets", kind: "number", cell: (row) => compactMoney(row.assets, "B", "en-US", "USD", { digits: 1 }) },
];

export default function Example() {
  const funds = useRowWindow<Fund>(fetchPage, []);
  const signIn = <TextLink href="#sign-in">Sign in to see every fund</TextLink>;
  return (
    <div className="flex w-full flex-col gap-3">
      <ResultCount
        count={funds.total}
        available={funds.rows.n}
        noun={{ one: "fund", other: "funds" }}
        status={funds.countStatus}
      >
        {signIn}
      </ResultCount>
      <div className="h-96 overflow-hidden rounded-2xl bg-card">
        <DataTable
          label="Funds"
          // The count line above already says the cap, so the line after the last row only says
          // where the list ends.
          labels={{ capped: (shown) => `End of the first ${shown} funds` }}
          columns={columns}
          rows={funds.rows}
          getRowId={(row) => row.id}
          fill
          onRangeChange={funds.onRangeChange}
          query={funds.query}
          status={funds.status}
          onRetry={funds.retry}
          attempt={funds.attempt}
          // After "End of the first 500 funds" on the line under the last row.
          capped={signIn}
          phoneMain="fund"
          phoneCount={false}
        />
      </div>
    </div>
  );
}
```

### State precedence
- Unknown and pending: unknown wins. A bar, busy; there is no last count to dim.
- Unknown and failure: failure wins. The bar goes, and the line keeps its height empty.
- Known and failure: known wins. A count from before the failure stays, since it is still the last known.
- Capped and partial or approximate: both show. "Showing the first 500 of about 12,400 funds".
- Capped and pending: both show. The capped sentence dims like any count.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| pending past the slow-wait delay, and back | announce | `--t-fade` on `--curve` | opacity | the same fade; opacity transitions stay under `reduce` |
| the bar while unknown | announce | Skeleton's own: clear for 250ms, then `--t-fade`, then its pulse | opacity | Skeleton's `motion-reduce:animate-none` |

## Props

<!-- Props generated from registry/cobalt/ui/result-count.tsx with TypeScript by scripts/props-table.mjs -->
| Prop | Type | Default | Purpose |
|---|---|---|---|
| `count` | `number` |  | How many items match. |
| `available?` | `number` |  | How many of them can be shown, when the server caps it below `count`, such as a plan's allowance. |
| `children?` | `ReactNode` |  | After the words, on the same line: what lifts a cap, such as a sign-in link. |
| `className?` | `string` |  |  |
| `labels?` | `Partial<ResultCountLabels>` |  |  |
| `locale?` | `string` | `"en-US"` |  |
| `noun?` | `PluralForms` | `{ one: "result", other: "results" }` | The noun, singular and plural, through `plural`: `{ one: "fund", other: "funds" }`. |
| `precision?` | `ResultCountPrecision` | `"exact"` | How far to trust `count`: `exact`, `approximate` for a server's estimate, or `partial` when the count stopped short, such as cursor pages whose end is not known yet. |
| `status?` | `Status` | `"idle"` | The answer's state. |

`count` is how many items match, undefined while unknown. `noun` is the singular and plural, `{ one: "fund", other: "funds" }`, "results" by default. `precision` is `exact`, `approximate` or `partial`. `available` is how many can be shown when the server caps it; at or above `count` it is no cap. `status` is the count's own state: from `useRowWindow` pass `countStatus`, which stays success while a block further down loads, and from a host that refetches pass its `status`. `children` follow the words. `labels` replaces every sentence, and `locale` the figures. `className` is for placement.

## Usage

### When to use
- A list, a table or a search shows how many items match, above the rows, and the number changes with a filter.
- The server counts roughly, stops counting, or hands out fewer rows than match.

### When not to use
- One figure that matters on a page, such as total assets. Use Stat instead.
- Which items of a paged list are on screen. Use Pagination's count line instead, which says "1 to 40 of 1,284".
- A count inside a control, such as a filter option's count. Use FilterBar instead, which writes each option's count beside it.

### Rules
- `rule/result-count-say-the-cap`: When the server hands out fewer rows than match, pass `available` with the full `count`, and the way to lift the cap as `children`, instead of the number of rows handed out as if it were the count, because "500 funds" when 12,400 match tells the person the list is complete. Evidence: principle heuristic: match between system and the real world, the count says what the server holds, as Fund Census says "Showing the first {n} results" with its sign-in link; single use `docs/system/examples/result-count/capped.tsx:77-79`. Check: test `result-count.test.tsx` renders the cap sentence and the link after it.
  - Don't: `<ResultCount count={funds.rows.n} noun={{ one: "fund", other: "funds" }} />` on a capped window
  - Do: `<ResultCount count={funds.total} available={funds.rows.n} noun={{ one: "fund", other: "funds" }}><TextLink href="/sign-in">Sign in to see every fund</TextLink></ResultCount>`
- `rule/result-count-honest-precision`: When the count is an estimate or a floor, set `precision` to `approximate` or `partial`, instead of showing the figure as exact, because a person compares an exact count across filters and trusts it, and an estimate or a running total read as exact misleads them. Evidence: principle heuristic: match between system and the real world, say only what is known; single use `docs/system/examples/result-count/partial.tsx:49`. Check: test `result-count.test.tsx` renders "About" and "At least"; review of every count from a search or a cursor.
  - Don't: `<ResultCount count={seen} noun={filings} />` while more pages follow
  - Do: `<ResultCount count={seen} precision="partial" noun={filings} />`
- `rule/result-count-window-count-status`: When the count comes from `useRowWindow`, pass `total` and `countStatus`, instead of the window's `status`, because the window is pending while any block on screen loads, and a count that dims every time you scroll into unloaded rows says it is changing when it is not. Evidence: measured the count dimming on a block retry with `status` and not with `countStatus` (`.design-system/evidence/result-count/dt-block-failed-1440-light.json`, the count's opacity 1 throughout); single use `docs/system/examples/data-table/windowed.tsx:87`. Check: review of every ResultCount fed by a window.
  - Don't: `<ResultCount count={funds.total} status={funds.status} noun={nouns} />`
  - Do: `<ResultCount count={funds.total} status={funds.countStatus} noun={nouns} />`

### Content
- Follows `rule/writing-no-invented-numbers`.
- `rule/result-count-noun-plural`: When the count names its items, pass `noun` with the singular and the plural, such as `{ one: "fund", other: "funds" }`, instead of a plural noun alone, because "1 funds" is wrong and every language picks its plural form by the number. Evidence: principle platform: `Intl.PluralRules` picks the form, through `plural` in `registry/cobalt/lib/format.ts`; single use `docs/system/examples/result-count/default.tsx:116`. Check: test `result-count.test.tsx` reads "1 fund" and "0 funds".
  - Don't: `<ResultCount count={n} noun={{ one: "funds", other: "funds" }} />`
  - Do: `<ResultCount count={n} noun={{ one: "fund", other: "funds" }} />`

### Anti-slop
- `rule/result-count-not-hand-rolled`: When a list shows its count, use `ResultCount` instead of a `p` with the number in it, because the part holds the line while the count is unknown, reads each new count once, dims with the rows and says caps and estimates in words a hand-written line leaves out. Evidence: app 4/4 count lines above the data table's examples and stress page use it (`rg -n "<ResultCount" docs/system/examples/data-table docs/system/stress/data-table.tsx`); principle heuristic: consistency and standards, one count line everywhere. Check: review of every count above a list.
  - Don't: `<p className="text-sm text-muted-foreground">{rows.length} funds</p>`
  - Do: `<ResultCount count={rows.length} noun={{ one: "fund", other: "funds" }} />`

### Limits
- `rule/result-count-wraps-not-cuts`: When the line is narrower than its words, as under about 280px, let them wrap instead of cutting them with `truncate`, because a count cut at its end loses the noun or the total, and the line is one line tall wherever the English sentences fit, which is from about 280px: measured at 320px the German capped sentence and its link took three lines, the English ones one. Evidence: measured three lines for the German capped sentence and its link at 320px and one line for each English sentence, on the stress page `docs/system/stress/result-count.tsx`. Check: review of `className` on every ResultCount for `truncate`.
  - Don't: `<ResultCount className="truncate" count={n} noun={nouns} />`
  - Do: `<ResultCount count={n} noun={nouns} />`

## Accessibility
Rests on a `p` with `role="status"`: a polite live region, mounted with the list and kept, so the first count is read when it lands and each new one after it.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Tab | before the line | skips the words, which take no focus, and reaches a link the host passed | the link | by hand |
| Enter | the link | follows it | the link's page | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| root | status | its text | `aria-busy` while unknown or pending, `data-precision` | each new count, politely, once | test |
| bar | none, `aria-hidden` | none | Skeleton's own | nothing | test |
| link | link | its text | the host's | its text and "link" on focus | by hand |

Contrast: the line is `--muted-foreground` on the card or the page, 6.01:1 light and 6.94:1 dark (the same pair as Empty's sentence, `.design-system/evidence/empty/measure-390.json`); dimmed, 55 percent of it, for at most the wait.

## Tokens
| Part | State | Token |
|---|---|---|
| root | all | `--muted-foreground`, text-sm, tabular figures, `min-h-lh` |
| root | pending | opacity 0.55, `--t-fade`, `--curve` |
| bar | unknown | Skeleton's bar, 7em |
| link | all | TextLink's `--primary-ink` |

## Related
- DataTable: the rows it counts, with the capped line after the last row.
- Pagination: which items of a paged list are on screen.
- Stat: one figure that matters on its own.
- Skeleton: the bar that holds the line while the count is unknown.
