<!-- generated by scripts/gen-docs.mjs from docs/system/page-problem.md. Edit the source and rerun. -->
# PageProblem

## Description
Takes the place of a page that could not load: what happened in plain words, and the one way on, such as Try again or Sign in again.

`import { PageProblem, pageProblemLabels, type PageProblemLabels } from "@/components/cobalt/ui/page-problem"`, source `registry/cobalt/ui/page-problem.tsx`, status `ready`.
`import { LongWaitNotice } from "@/components/cobalt/ui/long-wait-notice"`, source `registry/cobalt/ui/long-wait-notice.tsx`.
`import { Failure, Unconfirmed, failureOf, failureWords, wordsFor } from "@/lib/cobalt/failure"`, source `registry/cobalt/lib/failure.ts`.
`import { useLongWait } from "@/lib/cobalt/use-long-wait"`, source `registry/cobalt/lib/use-long-wait.ts`.
Foundation: `hand-rolled`. Traps checked: `trap/toast-errors`, `trap/live-region-double`, `trap/color-only-status`, `trap/loading-layout-shift`, `trap/loading-label-swap`, `trap/illustration-announced` (n/a: there is no illustration), `trap/demo-on-timers` (n/a: the waits in the examples stand in for a server), `trap/reduced-motion-ignored`.

`trap/toast-errors` is answered by the page's own words in place of the page, never a toast for a page that is gone (Rules). `trap/live-region-double` by one alert for the problem and the StateButton's own status line for the retry, with focus on the heading (ARIA). `trap/color-only-status` by words for every kind (States). `trap/loading-layout-shift` by the long-wait line that is there, empty, from the first frame (States). `trap/loading-label-swap` by the StateButton that keeps the action's name while it reads again (Motion). `trap/reduced-motion-ignored` by the long-wait words that only fade (Motion).

### Foundation
Not applicable: hand-rolled.

| Given by the foundation | Added by the team |
|---|---|
| Not applicable: hand-rolled, from the empty state's shape and the system's StateButton, with `useAction` behind the retry | A failure kind for every way a page fails (`registry/cobalt/lib/failure.ts`: offline, timeout, signed-out, forbidden, rate-limited, busy, not-found, failed, and the product's own), each with a title, a sentence and one action; `failureOf` reads the kind from a `Failure`, a response's status, a `TimeoutError` or the browser's offline state, so a reason phrase or a status code never reaches the screen; the document's title follows the heading and comes back on unmount; focus moves to the heading on mount; `role="alert"` except for not-found; retry kinds read again through a StateButton, link kinds go to `href`; an offline retry asks the server first through `checkOnline`; `LongWaitNotice` under the button, which says "This is taking longer than usual." after `SLOW_NOTICE_MS` (8 seconds) and restarts the read |

## Examples
A record that fails on its first read: the header's skeleton lines give way to the problem, Try again reads it again in place, and the record replaces the problem when it comes.

Real uses, 0 call sites (`rg -n "<PageProblem\b" app registry --glob '!registry/cobalt/ui/*'`): the part is new. Fund Census draws the same states by hand in its page module and the TSA app in its load-problem module (`docs/research/2026-10-17-fund-census-states.md`, section 2).

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/page-problem/default.tsx` | default | A record that could not load says what happened and offers one way on; Try again reads it again in place, and the record replaces the problem when it comes |
| `docs/system/examples/page-problem/kinds.tsx` | kind=failed | Every kind of failure in its own plain words, each with one way on |
| `docs/system/examples/page-problem/offline.tsx` | kind=offline | Offline, Try again asks the server first, and says Still offline while it cannot be reached |
| `docs/system/examples/page-problem/long-wait.tsx` | kind=timeout | A retry that hangs, with the long-wait line and its Retry |
| `docs/system/examples/page-problem/kinds.tsx` | kind=signed-out | Sign in again, a link |
| `docs/system/examples/page-problem/kinds.tsx` | kind=forbidden | Go home, a link |
| `docs/system/examples/page-problem/kinds.tsx` | kind=rate-limited | Wait a minute before trying again |
| `docs/system/examples/page-problem/kinds.tsx` | kind=busy | The service is busy |
| `docs/system/examples/page-problem/kinds.tsx` | kind=not-found | Page not found, an answer and not an alert |
| `docs/system/examples/page-problem/kinds.tsx` | kind=release-changed | A product's own kind with its own words |
| `docs/system/examples/page-problem/kinds.tsx` | state:alert | Every kind but not-found is an alert |
| `docs/system/examples/page-problem/kinds.tsx` | state:answer | Not found is read in place |
| `docs/system/examples/page-problem/default.tsx` | state:retrying | The StateButton reads again |
| `docs/system/examples/page-problem/offline.tsx` | state:still-failing | The retry fails and the problem stays |
| `docs/system/examples/page-problem/long-wait.tsx` | state:long-wait | Past 8 seconds the line says so, with Retry |
| `docs/system/examples/page-problem/default.tsx` | composition:DataList | The record the problem gives way to, with its header and facts |

Example: A record that could not load says what happened and offers one way on; Try again reads it again in place, and the record replaces the problem when it comes (`docs/system/examples/page-problem/default.tsx`)

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

import { DataList, DataListItem, DataListLabel, DataListValue } from "@/components/cobalt/ui/data-list";
import { PageHeader } from "@/components/cobalt/ui/page-header";
import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Failure } from "@/lib/cobalt/failure";

type Adviser = { name: string; city: string; registered: string; assets: string };

// Stands in for your API call. It answers after 1.2 seconds, unless the browser is offline or the
// address has ?network=offline.
const readAdviser = () =>
  new Promise<Adviser>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Failure("offline"));
      else resolve({ name: "Juniper Ridge Advisers", city: "Boston, Massachusetts", registered: "2009", assets: "$4.8B" });
    }, 1200),
  );

export default function Example() {
  const [adviser, setAdviser] = useState<Adviser | null>(null);
  // The page's first read has already failed, as a server error would.
  const [error, setError] = useState<unknown>(() => Failure.from({ status: 500 }));
  const open = async () => {
    try {
      setAdviser(await readAdviser());
      setError(null);
    } catch (caught) {
      setError(caught);
      throw caught;
    }
  };
  // A preview inside the docs: it leaves the docs page's focus and title alone. On a page of its own,
  // leave both props out, so focus moves to the heading and the tab says what happened.
  if (error !== null) return <PageProblem error={error} onRetry={open} focusOnMount={false} title={() => null} />;
  return (
    <div className="flex w-full flex-col gap-6">
      <PageHeader pending={adviser === null} eyebrow="Investment adviser" title={adviser?.name} description={adviser?.city} />
      <DataList pending={adviser === null}>
        <DataListItem>
          <DataListLabel>Registered since</DataListLabel>
          <DataListValue>{adviser?.registered}</DataListValue>
        </DataListItem>
        <DataListItem>
          <DataListLabel>Assets under management</DataListLabel>
          <DataListValue>{adviser?.assets}</DataListValue>
        </DataListItem>
      </DataList>
    </div>
  );
}
```

Example: The record the problem gives way to, with its header and facts (`docs/system/examples/page-problem/default.tsx`)

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

import { DataList, DataListItem, DataListLabel, DataListValue } from "@/components/cobalt/ui/data-list";
import { PageHeader } from "@/components/cobalt/ui/page-header";
import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Failure } from "@/lib/cobalt/failure";

type Adviser = { name: string; city: string; registered: string; assets: string };

// Stands in for your API call. It answers after 1.2 seconds, unless the browser is offline or the
// address has ?network=offline.
const readAdviser = () =>
  new Promise<Adviser>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Failure("offline"));
      else resolve({ name: "Juniper Ridge Advisers", city: "Boston, Massachusetts", registered: "2009", assets: "$4.8B" });
    }, 1200),
  );

export default function Example() {
  const [adviser, setAdviser] = useState<Adviser | null>(null);
  // The page's first read has already failed, as a server error would.
  const [error, setError] = useState<unknown>(() => Failure.from({ status: 500 }));
  const open = async () => {
    try {
      setAdviser(await readAdviser());
      setError(null);
    } catch (caught) {
      setError(caught);
      throw caught;
    }
  };
  // A preview inside the docs: it leaves the docs page's focus and title alone. On a page of its own,
  // leave both props out, so focus moves to the heading and the tab says what happened.
  if (error !== null) return <PageProblem error={error} onRetry={open} focusOnMount={false} title={() => null} />;
  return (
    <div className="flex w-full flex-col gap-6">
      <PageHeader pending={adviser === null} eyebrow="Investment adviser" title={adviser?.name} description={adviser?.city} />
      <DataList pending={adviser === null}>
        <DataListItem>
          <DataListLabel>Registered since</DataListLabel>
          <DataListValue>{adviser?.registered}</DataListValue>
        </DataListItem>
        <DataListItem>
          <DataListLabel>Assets under management</DataListLabel>
          <DataListValue>{adviser?.assets}</DataListValue>
        </DataListItem>
      </DataList>
    </div>
  );
}
```

## Variants

### kind
- `failed`: the server could not finish; Try again. The default for anything unknown. Used at 0 call sites.
- `offline`: the browser has no network; Try again asks the server first. Used at 0 call sites.
- `timeout`: a 408 or 504, or a read that timed out; Try again. Used at 0 call sites.
- `signed-out`: a 401; Sign in again, a link to `href`. Used at 0 call sites.
- `forbidden`: a 403; Go home, a link. Used at 0 call sites.
- `rate-limited`: a 429; Try again. Used at 0 call sites.
- `busy`: a 502 or 503; Try again. Used at 0 call sites.
- `not-found`: a 404 or 410; Go home, a link, and no alert. Used at 0 call sites.
- `release-changed`: a product's own kind, here Fund Census's data release, with its own `words`. Used at 0 call sites.

Example: Every kind of failure in its own plain words, each with one way on (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: Offline, Try again asks the server first, and says Still offline while it cannot be reached (`docs/system/examples/page-problem/offline.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";

// Stands in for your health check: it answers after 600ms, unless the browser is offline or the
// address has ?network=offline.
const health = () =>
  new Promise<boolean>((resolve) =>
    setTimeout(
      () => resolve(navigator.onLine && new URLSearchParams(location.search).get("network") !== "offline"),
      600,
    ),
  );

export default function Example() {
  const [back, setBack] = useState(false);
  if (back) return <p className="py-14 text-center text-sm text-muted-foreground">Back online. The page loaded.</p>;
  return (
    <PageProblem
      kind="offline"
      probe={health}
      onRetry={async () => setBack(true)}
      title={() => null}
      focusOnMount={false}
    />
  );
}
```

Example: A retry that hangs, with the long-wait line and its Retry (`docs/system/examples/page-problem/long-wait.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";

// Stands in for your API call. The first retry never answers, as a stuck request would; the next one
// answers after a second.
export default function Example() {
  const [done, setDone] = useState(false);
  const tries = useRef(0);
  const reread = () => {
    tries.current += 1;
    if (tries.current === 1) return new Promise<void>(() => {});
    return new Promise<void>((resolve) =>
      setTimeout(() => {
        setDone(true);
        resolve();
      }, 1000),
    );
  };
  if (done) return <p className="py-14 text-center text-sm text-muted-foreground">The page loaded.</p>;
  return <PageProblem kind="timeout" onRetry={reread} title={() => null} focusOnMount={false} />;
}
```

Example: Sign in again, a link (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: Go home, a link (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: Wait a minute before trying again (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: The service is busy (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: Page not found, an answer and not an alert (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: A product's own kind with its own words (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| alert | any kind but not-found | press the one action; read the description | the heading and the sentence; `role="alert"`; focus on the heading; the tab's title | test |
| answer | `kind="not-found"` | follow the link | the same words with no alert | test |
| retrying | Try again pressed | wait; nothing else to press | the StateButton's spinner and "Loading" after 250ms, its status line | screenshot |
| still-failing | the retry rejects | press again | the StateButton's cross on the red wash for 1.5 seconds, its status line, and "Still offline." or "It still did not load." in the line under the button until the next press | screenshot |
| long-wait | the retry has waited 8 seconds | press Retry, which cancels the read and sends a fresh one | "This is taking longer than usual." and Retry, in the line under the button that held their room | screenshot |

Example: Every kind but not-found is an alert (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: Not found is read in place (`docs/system/examples/page-problem/kinds.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/cobalt/ui/select";
import type { FailureKind } from "@/lib/cobalt/failure";

const kinds: { value: FailureKind; label: string }[] = [
  { value: "failed", label: "Failed" },
  { value: "offline", label: "Offline" },
  { value: "timeout", label: "Timed out" },
  { value: "signed-out", label: "Signed out" },
  { value: "forbidden", label: "No access" },
  { value: "rate-limited", label: "Too many requests" },
  { value: "busy", label: "Busy" },
  { value: "not-found", label: "Not found" },
  { value: "release-changed", label: "Data changed (your own kind)" },
];

// A product's own kind brings its own words.
const releaseChanged = {
  title: "The data release changed",
  description: "Figures changed while you were reading. Start again to see the current ones.",
  action: "Start again",
};

// Stands in for reading the page again: it answers after a second.
const reread = () => new Promise<void>((resolve) => setTimeout(resolve, 1000));

export default function Example() {
  const [kind, setKind] = useState<FailureKind>("failed");
  return (
    <div className="flex w-full flex-col items-center gap-2">
      <Field className="w-full max-w-60">
        <FieldLabel>Kind of failure</FieldLabel>
        <Select items={kinds} value={kind} onValueChange={(value) => setKind(String(value))}>
          <SelectTrigger className="w-full">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            {kinds.map((k) => (
              <SelectItem key={k.value} value={k.value}>
                {k.label}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </Field>
      {/* A preview beside other examples: it leaves the tab's title and the reader's focus alone. */}
      <PageProblem
        kind={kind}
        {...(kind === "release-changed" ? { words: releaseChanged } : {})}
        onRetry={reread}
        href="#"
        title={() => null}
        focusOnMount={false}
        className="min-h-80"
      />
    </div>
  );
}
```

Example: The StateButton reads again (`docs/system/examples/page-problem/default.tsx`)

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

import { DataList, DataListItem, DataListLabel, DataListValue } from "@/components/cobalt/ui/data-list";
import { PageHeader } from "@/components/cobalt/ui/page-header";
import { PageProblem } from "@/components/cobalt/ui/page-problem";
import { Failure } from "@/lib/cobalt/failure";

type Adviser = { name: string; city: string; registered: string; assets: string };

// Stands in for your API call. It answers after 1.2 seconds, unless the browser is offline or the
// address has ?network=offline.
const readAdviser = () =>
  new Promise<Adviser>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Failure("offline"));
      else resolve({ name: "Juniper Ridge Advisers", city: "Boston, Massachusetts", registered: "2009", assets: "$4.8B" });
    }, 1200),
  );

export default function Example() {
  const [adviser, setAdviser] = useState<Adviser | null>(null);
  // The page's first read has already failed, as a server error would.
  const [error, setError] = useState<unknown>(() => Failure.from({ status: 500 }));
  const open = async () => {
    try {
      setAdviser(await readAdviser());
      setError(null);
    } catch (caught) {
      setError(caught);
      throw caught;
    }
  };
  // A preview inside the docs: it leaves the docs page's focus and title alone. On a page of its own,
  // leave both props out, so focus moves to the heading and the tab says what happened.
  if (error !== null) return <PageProblem error={error} onRetry={open} focusOnMount={false} title={() => null} />;
  return (
    <div className="flex w-full flex-col gap-6">
      <PageHeader pending={adviser === null} eyebrow="Investment adviser" title={adviser?.name} description={adviser?.city} />
      <DataList pending={adviser === null}>
        <DataListItem>
          <DataListLabel>Registered since</DataListLabel>
          <DataListValue>{adviser?.registered}</DataListValue>
        </DataListItem>
        <DataListItem>
          <DataListLabel>Assets under management</DataListLabel>
          <DataListValue>{adviser?.assets}</DataListValue>
        </DataListItem>
      </DataList>
    </div>
  );
}
```

Example: The retry fails and the problem stays (`docs/system/examples/page-problem/offline.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";

// Stands in for your health check: it answers after 600ms, unless the browser is offline or the
// address has ?network=offline.
const health = () =>
  new Promise<boolean>((resolve) =>
    setTimeout(
      () => resolve(navigator.onLine && new URLSearchParams(location.search).get("network") !== "offline"),
      600,
    ),
  );

export default function Example() {
  const [back, setBack] = useState(false);
  if (back) return <p className="py-14 text-center text-sm text-muted-foreground">Back online. The page loaded.</p>;
  return (
    <PageProblem
      kind="offline"
      probe={health}
      onRetry={async () => setBack(true)}
      title={() => null}
      focusOnMount={false}
    />
  );
}
```

Example: Past 8 seconds the line says so, with Retry (`docs/system/examples/page-problem/long-wait.tsx`)

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

import { PageProblem } from "@/components/cobalt/ui/page-problem";

// Stands in for your API call. The first retry never answers, as a stuck request would; the next one
// answers after a second.
export default function Example() {
  const [done, setDone] = useState(false);
  const tries = useRef(0);
  const reread = () => {
    tries.current += 1;
    if (tries.current === 1) return new Promise<void>(() => {});
    return new Promise<void>((resolve) =>
      setTimeout(() => {
        setDone(true);
        resolve();
      }, 1000),
    );
  };
  if (done) return <p className="py-14 text-center text-sm text-muted-foreground">The page loaded.</p>;
  return <PageProblem kind="timeout" onRetry={reread} title={() => null} focusOnMount={false} />;
}
```

### State precedence
- Alert and answer: Not applicable: the kind is one or the other.
- Retrying and long-wait: both show. The button keeps its spinner while the line under it speaks.
- Long-wait and still-failing: still-failing wins. The long-wait words go the moment the wait ends, and the failure's words take the same line.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| a press of Try again | input | StateButton's Settle handover, `springs.settle` | opacity, transform of the label copy inside the box | the copy changes without moving, as StateButton's spec says |
| the long wait begins | announce | `duration-fade ease-out` from `starting:opacity-0` | opacity of the words and the Retry | the same fade; nothing moves |

## Props

<!-- Props generated from registry/cobalt/ui/page-problem.tsx, registry/cobalt/ui/long-wait-notice.tsx with TypeScript by scripts/props-table.mjs -->
### PageProblem

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `error?` | `unknown` |  | What the load threw or returned, for `failureOf` to read the kind from. |
| `focusOnMount?` | `boolean` | `true` | Moves focus to the heading when it mounts. |
| `href?` | `string` | `"/"` | Where a link kind goes: the sign-in page with a way back here, or home. |
| `kind?` | `FailureKind` |  | What went wrong. |
| `labels?` | `Partial<{ loading: string; checking: string; failed: string; offline: string; failedLine: string; offlineLine: string; longWait: string; longWaitRetry: string; }>` |  | The words around the retry, for a product in another language. |
| `onRetry?` | `() => Promise<unknown>` |  | Reads the page again. |
| `probe?` | `Probe` |  | The health check an offline retry asks first: an address, or a function. |
| `renderLink?` | `RenderLink` | `defaultLink` |  |
| `title?` | `(heading: string) => string` | `(heading) => heading` | The document's title while this shows, from the heading. |
| `words?` | `Partial<FailureWords>` |  | Words laid over the kind's own: a product's own kind, or a sharper description. |

Also accepts every native `<div>` attribute.

### LongWaitNotice

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `waiting` | `boolean` |  | True while the request is out. |
| `after?` | `number` |  | Milliseconds before the notice shows; SLOW_NOTICE_MS by default. |
| `attempt?` | `number` |  | The request's attempt number, so a restarted request is a new wait. |
| `children?` | `ReactNode` | `"This is taking longer than usual."` | The words, "This is taking longer than usual." by default. |
| `onRetry?` | `() => void` |  | Cancels the request and sends it again. |
| `reserve?` | `boolean` | `true` | Hold the line's room while there is nothing to say. |
| `retryLabel?` | `string` | `"Retry"` |  |

Also accepts every native `<div>` attribute.

`kind` picks the words; leave it out and pass `error` to read the kind with `failureOf`. `words` lays a title, a description, an action or a way over the kind's own, and gives a product's own kind its words. `onRetry` reads the page again and resolves once it has what it needs. `href` is where a link kind goes, "/" by default, through `renderLink`. `probe` is the health check an offline retry asks first. `title` makes the document's title from the heading, or returns null to leave it. `focusOnMount` (true) moves focus to the heading on mount. `labels` replaces any of the words around the retry, for a product in another language: the button's `loading`, `checking`, `failed` and `offline` words ("Loading", "Checking", "Did not load", "Still offline"), the line under it after a failed retry, `failedLine` and `offlineLine` ("It still did not load.", "Still offline."), and the long-wait line's `longWait` and `longWaitRetry`; `pageProblemLabels` holds the English. `className` is for placement.

`LongWaitNotice` takes `waiting`, `attempt` from `useAction`, `onRetry`, `after` (`SLOW_NOTICE_MS` by default), `retryLabel`, `reserve` (true, the line holds its room) and its words as `children`.

## Usage

### When to use
- A page has nothing to show because its first read failed: a record that is gone, a session that ended, no network.
- A whole route's loader or error boundary fails, in a product with a router.

### When not to use
- A list or a section inside a page failed while the rest loaded. Use Empty instead, with `reason="error"`.
- The page shows data and a later read failed. Use Banner instead, or a toast, and keep the data.
- A form could not save. Use Field's error and StateButton instead.

### Rules
- `rule/page-problem-kind-not-phrase`: When a read fails, pass the error as `error` or its kind as `kind`, instead of the server's reason phrase or status as words, because "Forbidden" or "HTTP 429" tells a person nothing they can do, and the kind's words say what happened and the way on. Evidence: measured Fund Census showing "Too Many Requests" and "Forbidden" as copy, docs/research/2026-10-17-fund-census-states.md section 2; principle heuristic: help users recognize, diagnose and recover from errors. Check: test `failure.test.tsx` "no status ever shows its reason phrase, a code or the word HTTP".
  - Don't: `<PageProblem words={{ title: response.statusText }} />`
  - Do: `<PageProblem error={Failure.from(response)} onRetry={reload} />`
- `rule/page-problem-data-stays`: When a page already shows data and a later read fails, keep the data on screen and say so with `OfflineBanner` or a toast, instead of swapping the page for `PageProblem`, because a press while offline that wipes the page takes away what the person was reading. Evidence: person D37; measured Fund Census swapping the page for its Problem card on a click while offline, docs/research/2026-10-17-fund-census-states.md section 2; single use docs/system/examples/banner/default.tsx:35-36, the rows stay when a refresh fails offline. Check: review of every `PageProblem` whose page can already hold data.
  - Don't: `if (refresh.error) return <PageProblem error={refresh.error} />`
  - Do: `if (data === undefined && error) return <PageProblem error={error} onRetry={load} />`
- `rule/page-problem-retry-in-place`: When a retry kind reads again, pass an `onRetry` that reads the page's data again in place, such as a router's revalidate, instead of `location.reload()`, because a reload throws away the scroll position and the shell, and its wait cannot show on the button. Evidence: app 2/2 source apps read again in place, the TSA app's `revalidator.revalidate()` and Fund Census's `retry`, docs/research/2026-10-17-missing-parts.md F5. Check: review.
  - Don't: `<PageProblem kind="failed" onRetry={async () => location.reload()} />`
  - Do: `<PageProblem kind="failed" onRetry={() => revalidator.revalidate()} />`
- `rule/page-problem-sign-in-returns`: When the kind is `signed-out`, pass an `href` that leads to sign-in and back to this page, instead of the bare sign-in address, because a person whose session ended mid-task wants to land where they were. Evidence: app 1/2 source apps, the TSA app's `useSignInAgainHref` returns to the page after sign-in, docs/research/2026-10-17-missing-parts.md F5; principle heuristic: user control and freedom. Check: test `page-problem.test.tsx` renders the link with its return address.
  - Don't: `<PageProblem kind="signed-out" href="/sign-in" />`
  - Do: `<PageProblem kind="signed-out" href={`/sign-in?back=${encodeURIComponent(location.pathname)}`} />`

### Content
- Follows `rule/writing-no-invented-numbers`.
- `rule/page-problem-own-kind-words`: When a product adds its own kind, give `words` a title that says what happened in at most 8 words with no period, a description of one sentence on what to do, and an action of at most 3 words that is a verb, such as "Start again", instead of "Something went wrong" or "Error", because the title is the tab's name and the screen reader's first words. Evidence: principle heuristic: help users recognize, diagnose and recover from errors; app 1/2 source apps, Fund Census's "The data release changed" with Start again. Check: test `failure.test.tsx` "every built-in kind has a title, a sentence and one verb".
  - Don't: `words={{ title: "Oops! Something went wrong.", action: "OK" }}`
  - Do: `words={{ title: "The data release changed", description: "Figures changed while you were reading. Start again to see the current ones.", action: "Start again" }}`

### Anti-slop
- `rule/page-problem-no-illustration`: When showing a page problem, use its heading, sentence and one action alone, instead of adding an illustration, an icon or a second "Contact support" button, because the words are what a person acts on and a second action halves the first. Evidence: principle heuristic: aesthetic and minimalist design; person D14, no decoration. Check: review.
  - Don't: `<><BrokenRobot /><PageProblem kind="failed" /><Button>Contact support</Button></>`
  - Do: `<PageProblem kind="failed" onRetry={load} />`

### Limits
- `rule/page-problem-title-length`: When a product's own title runs past 60 characters, shorten it and move the detail into the description, because at 320px a 79-character title breaks onto 7 lines and pushes the action below a phone's fold. Evidence: measured the German title of 79 characters on 7 lines at 320 and 5 lines at 390, docs/system/stress/page-problem.tsx. Check: probe docs/system/stress/page-problem.tsx on the break-ui harness at 320.
  - Don't: `words={{ title: "Die Datenveröffentlichung hat sich geändert, während Sie diese Seite gelesen haben" }}`
  - Do: `words={{ title: "Die Daten haben sich geändert" }}`

## Accessibility
Rests on an `h1` that takes focus (`tabIndex={-1}`), a `role="alert"` container named by it, and StateButton or a link for the one action.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| none | the problem mounts | focus moves to the heading, so a screen reader starts at what happened | the heading | by hand |
| Tab | the heading | moves to the one action | Try again, or the link | by hand |
| Enter | Try again | reads the page again | stays on the button while it waits | by hand |
| Enter | Retry in the long-wait line | cancels the read and sends a fresh one | the Retry, which hides once the wait ends | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| root | alert, except for not-found | the heading through `aria-labelledby` | `data-kind` for styling only | the heading and the sentence, once, on mount | test |
| heading | heading, level 1 | its text | `tabindex="-1"` | its text when focus lands on it | test |
| action | button or link | the kind's action | StateButton's `aria-busy` while it reads | StateButton's status line: "Loading", then the result | test |
| long-wait line | status | none | none | "This is taking longer than usual." once, after 8 seconds | test |

## Tokens
| Part | State | Token |
|---|---|---|
| heading | all | `--foreground`, `--text-2xl` |
| sentence, long-wait words | all | `--muted-foreground` |
| long-wait words | arrive | `--t-fade`, `--curve` |
| action | all | the Button tokens |

## Related
- Empty: a list or a section with nothing in it, or whose read failed.
- Banner: the offline line for a page that keeps its data.
- PageHeader: the head of the record a problem gives way to.
- StateButton: the retry that reports its own wait.
- Alert: a note about the page before the person goes on.
