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

## Description
Collects what happened while the person was away, such as filings, mentions and alerts, under a bell that counts the unread ones, grouped by day, with the unread ones marked and one press to mark them all read.

`import { Inbox, InboxList, groupByDay, type InboxNotice } from "@/components/cobalt/ui/inbox"`, source `registry/cobalt/ui/inbox.tsx`, status `ready-with-gaps`.
Foundation: `hand-rolled (the panel on Popover, a bottom Sheet on a phone; rows on Item; Unread on SegmentedControl; Mark all read on StateButton and useAction; empty and failed on Empty; times on RelativeTime)`. Traps checked: `trap/color-only-status`, `trap/live-region-double`, `trap/loading-layout-shift`, `trap/toast-errors`, `trap/overlay-title`, `trap/overlay-focus-return`, `trap/overlay-no-max-height`, `trap/scroll-chain`, `trap/numbers-shift`, `trap/weight-shift`, `trap/list-dead-gap`, `trap/link-as-button`, `trap/demo-on-timers`, `trap/motion-frequent`.

`trap/color-only-status` is answered by the unread mark, a 10px rounded square, and the word "Unread" read before the sentence, beside the ink (States). `trap/live-region-double` by StateButton's one announcement for Mark all read. `trap/loading-layout-shift` by three rows in a real row's geometry while the first read is on its way, and by the unread mark keeping its room on a read row (measured). `trap/toast-errors` by the failed read said in the list's place with Try again, never in a toast. `trap/overlay-title` by the popover's name, "Notifications", the sheet's title on a phone. `trap/overlay-focus-return` by Popover, which returns focus to the bell. `trap/overlay-no-max-height` by the list's 448px cap in the popover and the sheet's own on a phone. `trap/scroll-chain` by `overscroll-contain`. `trap/numbers-shift` by tabular figures in the badge. `trap/weight-shift` by one weight for read and unread. `trap/list-dead-gap` by rows that are the whole target. `trap/link-as-button` by rows that are links when they have an address. `trap/demo-on-timers` n/a: the examples wait on a stand-in request, never on a timer that pretends. `trap/motion-frequent` by colour and opacity only on a row.

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| `Popover` from `registry/cobalt/ui/popover.tsx`: the panel under its trigger from 640px, the bottom sheet below, the portal and focus return | The bell: `IconButton` with the unread count as a `Badge` at the glyph's corner, 99+ past 99, and the count in its name; the panel 384px wide, its title, then All and Unread beside Mark all read on one row, the same in the sheet, and the list in a 448px scroller |
| `Item` from `registry/cobalt/ui/item.tsx` | A row per notice: its picture in a 36px column, the sentence, the time, and a 10px accent mark for unread that keeps its room when read |
| `StateButton` and `useAction` from `registry/cobalt/ui/state-button.tsx` and `registry/cobalt/lib/use-action.ts` | Mark all read reports Marking, Marked or Not marked in the button; the rows turn read only when the server says so; it is off when nothing is unread |
| `SegmentedControl` from `registry/cobalt/ui/segmented-control.tsx` | All and Unread; the unread view holds the notices that were unread when it was chosen or the inbox opened, so reading one never pulls its row away |
| `Empty`, `Skeleton`, `RelativeTime` | Three placeholder rows for the first read, a failed read with Try again, an empty inbox and a read-out one in their own words; `groupByDay` for the headings, today's times as how long ago and older ones as the time of day |

## Examples
The bell with its unread count; the list under it groups notices by day, filters to unread, and marks all read through the server, saying so in the button.

Real uses, 0 call sites (`rg -n "<Inbox\b" app registry --glob '!registry/cobalt/ui/*'`): the part is new. It takes the bell, its 99+ count and its phone sheet from TSA (`~/tsaglobal-superapp-live/apps/web/app/components/notifications/notifications-bell.tsx`) and the marks kept for the whole opening from its `seen.ts`, and leaves out TSA's unseen dot and its popover's scale (`docs/research/2026-10-17-missing-parts.md`, F12).

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/inbox/default.tsx` | default | The bell with its unread count, the list by day, Unread, and Mark all read through the server |
| `docs/system/examples/inbox/default.tsx` | state:unread | Two notices unread, in the ink with the mark |
| `docs/system/examples/inbox/default.tsx` | state:marking | Mark all read says Marking past 250ms, then Marked or Not marked |
| `docs/system/examples/inbox/first-read.tsx` | state:loading | Three rows hold the list's place while its first read is on its way |
| `docs/system/examples/inbox/first-read.tsx` | state:failed | A failed first read says so in the list's place with Try again |
| `docs/system/examples/inbox/empty.tsx` | state:empty | Nothing has arrived yet: what will show there and the way to choose it |
| `docs/system/examples/inbox/first-read.tsx` | composition:Card | The list on a notifications page of its own, on a card |

Example: The bell with its unread count, the list by day, Unread, and Mark all read through the server (`docs/system/examples/inbox/default.tsx`)

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

import { FileTextIcon, UsersIcon } from "@/components/cobalt/icon";
import { Avatar, AvatarFallback } from "@/components/cobalt/ui/avatar";
import { Button } from "@/components/cobalt/ui/button";
import { Inbox, type InboxNotice } from "@/components/cobalt/ui/inbox";
import { ItemIcon } from "@/components/cobalt/ui/item";

// 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 = () =>
  new Promise<void>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve();
    }, 900),
  );

// A fixed moment, so the days and times read the same on every visit.
const now = Date.UTC(2026, 9, 16, 15, 0);
const hour = 3_600_000;

const seed: InboxNotice[] = [
  {
    id: "calder-13f",
    text: "Calder Global Equity filed a 13F for the third quarter",
    at: now - 2 * hour,
    read: false,
    href: "#calder-13f",
    media: (
      <ItemIcon>
        <FileTextIcon />
      </ItemIcon>
    ),
  },
  {
    id: "amara-mention",
    text: "Amara Okafor mentioned you in Private credit over $1 billion",
    at: now - 5 * hour,
    read: false,
    href: "#amara-mention",
    media: (
      <Avatar decorative>
        <AvatarFallback>AO</AvatarFallback>
      </Avatar>
    ),
  },
  {
    id: "northgate-adv",
    text: "Northgate Advisors amended its Form ADV",
    at: now - 26 * hour,
    read: true,
    href: "#northgate-adv",
    media: (
      <ItemIcon>
        <FileTextIcon />
      </ItemIcon>
    ),
  },
  {
    id: "team-join",
    text: "Lukas Brandt joined your team",
    at: now - 4 * 24 * hour,
    read: true,
    href: "#team",
    media: (
      <ItemIcon>
        <UsersIcon />
      </ItemIcon>
    ),
  },
];

export default function Example() {
  const [notices, setNotices] = useState(seed);
  return (
    // The top bar it lives in: the page's name at the start, the bell at the end.
    <div className="flex w-full items-center justify-between gap-3">
      <span className="text-base font-semibold">Filings</span>
      <Inbox
        notices={notices}
        now={now}
        onOpenNotice={(opened) =>
          setNotices((was) => was.map((n) => (n.id === opened.id ? { ...n, read: true } : n)))
        }
        onMarkAllRead={async () => {
          await request();
          setNotices((was) => was.map((n) => ({ ...n, read: true })));
        }}
        emptyAction={
          <Button variant="secondary" render={<a href="#notification-settings" />}>
            Choose what shows here
          </Button>
        }
      />
    </div>
  );
}
```

Example: The list on a notifications page of its own, on a card (`docs/system/examples/inbox/first-read.tsx`)

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

import { InboxList, type InboxNotice } from "@/components/cobalt/ui/inbox";

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

// A fixed moment, so the days and times read the same on every visit.
const now = Date.UTC(2026, 9, 16, 15, 0);
const hour = 3_600_000;
const notices: InboxNotice[] = [
  { id: "calder-13f", text: "Calder Global Equity filed a 13F for the third quarter", at: now - 2 * hour, read: false, href: "#calder-13f" },
  { id: "northgate-adv", text: "Northgate Advisors amended its Form ADV", at: now - 26 * hour, read: true, href: "#northgate-adv" },
];

export default function Example() {
  const [list, setList] = useState<InboxNotice[] | null>(null);
  const [failed, setFailed] = useState(false);
  const [retrying, setRetrying] = useState(false);
  const load = () => {
    setRetrying(true);
    read().then(
      (answer) => {
        setList(answer);
        setFailed(false);
      },
      () => setFailed(true),
    ).finally(() => setRetrying(false));
  };
  useEffect(load, []);
  return (
    <div className="w-full max-w-md rounded-2xl bg-card p-2">
      <InboxList notices={list} failed={failed} onRetry={load} retrying={retrying} now={now} />
    </div>
  );
}
```

## Variants
Not applicable: one bell and one list.

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| unread | a notice with `read: false` | open it, which the host marks read | the 10px rounded mark at the row's end, "Unread" read before the sentence, the ink; the count on the bell | test |
| read | `read: true` | open it again | the mark's room kept, empty; the sentence muted | test |
| loading | `notices` null on the first read | wait | three rows in a busy list named "Loading notifications" | test |
| failed | `notices` null and `failed` | try again | an alert in the list's place, "Notifications did not load", and Try again | test |
| empty | no notices | choose what shows there through `emptyAction` | "No notifications yet" and one line on what will show | test |
| none-unread | the Unread view with every notice read | go back to All | "Nothing unread" | test |
| marking | Mark all read pressed | wait; the button keeps its place and its focus | after 250ms a spinner and "Marking", then "Marked" or "Not marked" | by hand |
| over 99 | more than 99 unread | the same | the badge reads 99+; the bell's name says the whole figure | test |
| hover, focus-visible | pointer over a row, or Tab onto it | open it | the grey fill; the outline on its 12px corner | by hand |

Example: Two notices unread, in the ink with the mark (`docs/system/examples/inbox/default.tsx`)

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

import { FileTextIcon, UsersIcon } from "@/components/cobalt/icon";
import { Avatar, AvatarFallback } from "@/components/cobalt/ui/avatar";
import { Button } from "@/components/cobalt/ui/button";
import { Inbox, type InboxNotice } from "@/components/cobalt/ui/inbox";
import { ItemIcon } from "@/components/cobalt/ui/item";

// 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 = () =>
  new Promise<void>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve();
    }, 900),
  );

// A fixed moment, so the days and times read the same on every visit.
const now = Date.UTC(2026, 9, 16, 15, 0);
const hour = 3_600_000;

const seed: InboxNotice[] = [
  {
    id: "calder-13f",
    text: "Calder Global Equity filed a 13F for the third quarter",
    at: now - 2 * hour,
    read: false,
    href: "#calder-13f",
    media: (
      <ItemIcon>
        <FileTextIcon />
      </ItemIcon>
    ),
  },
  {
    id: "amara-mention",
    text: "Amara Okafor mentioned you in Private credit over $1 billion",
    at: now - 5 * hour,
    read: false,
    href: "#amara-mention",
    media: (
      <Avatar decorative>
        <AvatarFallback>AO</AvatarFallback>
      </Avatar>
    ),
  },
  {
    id: "northgate-adv",
    text: "Northgate Advisors amended its Form ADV",
    at: now - 26 * hour,
    read: true,
    href: "#northgate-adv",
    media: (
      <ItemIcon>
        <FileTextIcon />
      </ItemIcon>
    ),
  },
  {
    id: "team-join",
    text: "Lukas Brandt joined your team",
    at: now - 4 * 24 * hour,
    read: true,
    href: "#team",
    media: (
      <ItemIcon>
        <UsersIcon />
      </ItemIcon>
    ),
  },
];

export default function Example() {
  const [notices, setNotices] = useState(seed);
  return (
    // The top bar it lives in: the page's name at the start, the bell at the end.
    <div className="flex w-full items-center justify-between gap-3">
      <span className="text-base font-semibold">Filings</span>
      <Inbox
        notices={notices}
        now={now}
        onOpenNotice={(opened) =>
          setNotices((was) => was.map((n) => (n.id === opened.id ? { ...n, read: true } : n)))
        }
        onMarkAllRead={async () => {
          await request();
          setNotices((was) => was.map((n) => ({ ...n, read: true })));
        }}
        emptyAction={
          <Button variant="secondary" render={<a href="#notification-settings" />}>
            Choose what shows here
          </Button>
        }
      />
    </div>
  );
}
```

Example: Mark all read says Marking past 250ms, then Marked or Not marked (`docs/system/examples/inbox/default.tsx`)

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

import { FileTextIcon, UsersIcon } from "@/components/cobalt/icon";
import { Avatar, AvatarFallback } from "@/components/cobalt/ui/avatar";
import { Button } from "@/components/cobalt/ui/button";
import { Inbox, type InboxNotice } from "@/components/cobalt/ui/inbox";
import { ItemIcon } from "@/components/cobalt/ui/item";

// 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 = () =>
  new Promise<void>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve();
    }, 900),
  );

// A fixed moment, so the days and times read the same on every visit.
const now = Date.UTC(2026, 9, 16, 15, 0);
const hour = 3_600_000;

const seed: InboxNotice[] = [
  {
    id: "calder-13f",
    text: "Calder Global Equity filed a 13F for the third quarter",
    at: now - 2 * hour,
    read: false,
    href: "#calder-13f",
    media: (
      <ItemIcon>
        <FileTextIcon />
      </ItemIcon>
    ),
  },
  {
    id: "amara-mention",
    text: "Amara Okafor mentioned you in Private credit over $1 billion",
    at: now - 5 * hour,
    read: false,
    href: "#amara-mention",
    media: (
      <Avatar decorative>
        <AvatarFallback>AO</AvatarFallback>
      </Avatar>
    ),
  },
  {
    id: "northgate-adv",
    text: "Northgate Advisors amended its Form ADV",
    at: now - 26 * hour,
    read: true,
    href: "#northgate-adv",
    media: (
      <ItemIcon>
        <FileTextIcon />
      </ItemIcon>
    ),
  },
  {
    id: "team-join",
    text: "Lukas Brandt joined your team",
    at: now - 4 * 24 * hour,
    read: true,
    href: "#team",
    media: (
      <ItemIcon>
        <UsersIcon />
      </ItemIcon>
    ),
  },
];

export default function Example() {
  const [notices, setNotices] = useState(seed);
  return (
    // The top bar it lives in: the page's name at the start, the bell at the end.
    <div className="flex w-full items-center justify-between gap-3">
      <span className="text-base font-semibold">Filings</span>
      <Inbox
        notices={notices}
        now={now}
        onOpenNotice={(opened) =>
          setNotices((was) => was.map((n) => (n.id === opened.id ? { ...n, read: true } : n)))
        }
        onMarkAllRead={async () => {
          await request();
          setNotices((was) => was.map((n) => ({ ...n, read: true })));
        }}
        emptyAction={
          <Button variant="secondary" render={<a href="#notification-settings" />}>
            Choose what shows here
          </Button>
        }
      />
    </div>
  );
}
```

Example: Three rows hold the list's place while its first read is on its way (`docs/system/examples/inbox/first-read.tsx`)

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

import { InboxList, type InboxNotice } from "@/components/cobalt/ui/inbox";

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

// A fixed moment, so the days and times read the same on every visit.
const now = Date.UTC(2026, 9, 16, 15, 0);
const hour = 3_600_000;
const notices: InboxNotice[] = [
  { id: "calder-13f", text: "Calder Global Equity filed a 13F for the third quarter", at: now - 2 * hour, read: false, href: "#calder-13f" },
  { id: "northgate-adv", text: "Northgate Advisors amended its Form ADV", at: now - 26 * hour, read: true, href: "#northgate-adv" },
];

export default function Example() {
  const [list, setList] = useState<InboxNotice[] | null>(null);
  const [failed, setFailed] = useState(false);
  const [retrying, setRetrying] = useState(false);
  const load = () => {
    setRetrying(true);
    read().then(
      (answer) => {
        setList(answer);
        setFailed(false);
      },
      () => setFailed(true),
    ).finally(() => setRetrying(false));
  };
  useEffect(load, []);
  return (
    <div className="w-full max-w-md rounded-2xl bg-card p-2">
      <InboxList notices={list} failed={failed} onRetry={load} retrying={retrying} now={now} />
    </div>
  );
}
```

Example: A failed first read says so in the list's place with Try again (`docs/system/examples/inbox/first-read.tsx`)

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

import { InboxList, type InboxNotice } from "@/components/cobalt/ui/inbox";

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

// A fixed moment, so the days and times read the same on every visit.
const now = Date.UTC(2026, 9, 16, 15, 0);
const hour = 3_600_000;
const notices: InboxNotice[] = [
  { id: "calder-13f", text: "Calder Global Equity filed a 13F for the third quarter", at: now - 2 * hour, read: false, href: "#calder-13f" },
  { id: "northgate-adv", text: "Northgate Advisors amended its Form ADV", at: now - 26 * hour, read: true, href: "#northgate-adv" },
];

export default function Example() {
  const [list, setList] = useState<InboxNotice[] | null>(null);
  const [failed, setFailed] = useState(false);
  const [retrying, setRetrying] = useState(false);
  const load = () => {
    setRetrying(true);
    read().then(
      (answer) => {
        setList(answer);
        setFailed(false);
      },
      () => setFailed(true),
    ).finally(() => setRetrying(false));
  };
  useEffect(load, []);
  return (
    <div className="w-full max-w-md rounded-2xl bg-card p-2">
      <InboxList notices={list} failed={failed} onRetry={load} retrying={retrying} now={now} />
    </div>
  );
}
```

Example: Nothing has arrived yet: what will show there and the way to choose it (`docs/system/examples/inbox/empty.tsx`)

```tsx
import { Button } from "@/components/cobalt/ui/button";
import { Inbox } from "@/components/cobalt/ui/inbox";

export default function Example() {
  return (
    // The top bar it lives in: the page's name at the start, the bell at the end.
    <div className="flex w-full items-center justify-between gap-3">
      <span className="text-base font-semibold">Filings</span>
      <Inbox
        notices={[]}
        onMarkAllRead={async () => {}}
        emptyAction={
          <Button variant="secondary" render={<a href="#notification-settings" />}>
            Choose what shows here
          </Button>
        }
      />
    </div>
  );
}
```

### State precedence
- Unread and read: Not applicable: a notice is one or the other.
- Loading and failed: failed wins. The rows give way to the alert.
- Empty and none-unread: Not applicable: none-unread needs notices, empty has none.
- Marking and unread: both show. The rows stay unread until the server answers.
- Unread view and read: both show. A notice read while the inbox is open keeps its row there, muted, until it opens again.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| the panel opens and closes | input | Popover's Pop, `--t-pop` on `--curve`; Sheet's Slide on a phone | opacity; translate on a phone | a fade |
| a notice becomes read | announce | `--t-press` on `--curve` for the ink, `--t-fade` for the mark | color, opacity | the same; nothing moves |
| Mark all read waits and answers | announce | StateButton's handover | opacity, translate of its label inside the button | a fade |

Measured at 1440 (`.design-system/evidence/inbox/read-1440.json`): the panel is 384px wide, and every row keeps its top and its height, 74 and 54px, when Mark all read turns the list read.

## Props

<!-- Props generated from registry/cobalt/ui/inbox.tsx with TypeScript by scripts/props-table.mjs -->
### Inbox

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `notices` | `readonly InboxNotice[]` |  | The notices, newest first or in any order; null while the first read is on its way. |
| `onMarkAllRead` | `() => Promise<void>` |  | Marks every notice read on the server. |
| `className?` | `string` |  | Placement of the bell. |
| `emptyAction?` | `ReactNode` |  | What an empty inbox offers, such as a link to choose what shows here. |
| `failed?` | `boolean` |  | The first read failed. |
| `labels?` | `InboxLabels` | `{}` |  |
| `locale?` | `string` |  |  |
| `now?` | `number \| Date` |  | Pass a fixed moment so the days and times read the same on every visit. |
| `onIntent?` | `() => void` |  |  |
| `onOpenChange?` | `(open: boolean) => void` |  |  |
| `onOpenNotice?` | `(notice: InboxNotice) => void` |  | A row was pressed: mark it read and go where it leads. |
| `onRetry?` | `() => void` |  |  |
| `open?` | `boolean` |  |  |
| `renderLink?` | `RenderLink` |  |  |
| `retrying?` | `boolean` |  |  |
| `timeZone?` | `string` |  |  |

### InboxList

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `notices` | `readonly InboxNotice[]` |  | The notices, newest first or in any order; null while the first read is on its way. |
| `className?` | `string` |  |  |
| `emptyAction?` | `ReactNode` |  | What an empty inbox offers, such as a link to choose what shows here. |
| `failed?` | `boolean` | `false` | The first read failed. |
| `labels?` | `InboxLabels` | `{}` |  |
| `locale?` | `string` |  |  |
| `now?` | `number \| Date` |  | Pass a fixed moment so the days and times read the same on every visit. |
| `onOpenNotice?` | `(notice: InboxNotice) => void` |  | A row was pressed: mark it read and go where it leads. |
| `onRetry?` | `() => void` |  |  |
| `renderLink?` | `RenderLink` | `defaultLink` |  |
| `retrying?` | `boolean` | `false` |  |
| `timeZone?` | `string` |  |  |
| `unreadIds?` | `ReadonlySet<string>` |  | The ids the unread view holds, so a notice read while the list is open stays where it is. |
| `view?` | `"all" \| "unread"` | `"all"` | `unread` shows the notices that were unread when the view was chosen. |

`Inbox` takes `notices` (null while the first read is on its way), `failed`, `onRetry` and `retrying` for that read, `onMarkAllRead` (a promise), `onOpenNotice`, `onIntent` (the pointer or focus reached the bell), `open` and `onOpenChange`, `emptyAction`, `now`, `locale`, `timeZone`, `renderLink` and `labels`. `InboxList` takes the same list props with `view` and `unreadIds`, for a notifications page. `InboxNotice` is `id`, `text`, `at`, `read`, `href` and `media`. `groupByDay` takes notices and `now`, `locale`, `timeZone`, `undated`.

## Usage

### When to use
- A product that tells the person about things that happened while they were away: filings from funds they follow, mentions, approvals.
- A notifications page with the same list, through `InboxList`.

### When not to use
- A message about what the person just did. Use Toast instead.
- A condition of the page they are on, such as a limit reached. Use Alert instead.
- A conversation. Use Thread instead.

### Rules
- `rule/inbox-read-on-open`: When a notice is opened, mark it read in `onOpenNotice`, instead of marking the list read when it opens, because a list read by opening it loses the marks the person opened it to see. Evidence: principle heuristic: visibility of system status; single use docs/system/examples/inbox/default.tsx:85-86. Check: review.
  - Don't: `onOpenChange={(open) => open && markAllRead()}`
  - Do: `onOpenNotice={(n) => markRead(n.id)}`
- `rule/inbox-mark-all-honest`: When marking all read, pass `onMarkAllRead` as the server's promise and turn the rows read after it resolves, instead of setting them read on the press, because the button then says Marking, Marked or Not marked and never shows a list as read that the server has not marked. Evidence: person D39; single use docs/system/examples/inbox/default.tsx:88-91. Check: review.
  - Don't: `onMarkAllRead={async () => { setAllRead(); void api.markAll(); }}`
  - Do: `onMarkAllRead={async () => { await api.markAll(); setAllRead(); }}`
- `rule/inbox-read-before-press`: When the list comes from a server, start the read in `onIntent`, instead of on the press, because the pointer reaching the bell is about 300ms before the press, and the panel then opens on the list rather than on three placeholder rows. Evidence: principle input: the pointer reaches a control before it presses it; principle heuristic: visibility of system status. Check: review.
  - Don't: `<Inbox notices={null} onOpenChange={(o) => o && load()} />`
  - Do: `<Inbox notices={list} onIntent={load} />`

### Content
- `rule/inbox-sentence-names-who`: When writing a notice's `text`, name who did what in one sentence, such as "Calder Global Equity filed a 13F", in at most 90 characters, instead of a heading and a body, because each row is read once among many and the time already sits under it. Evidence: measured 74px rows of two lines at 384px, `.design-system/evidence/inbox/read-1440.json`. Check: review.
  - Don't: `text: "New filing! A fund you follow has new activity."`
  - Do: `text: "Calder Global Equity filed a 13F for the third quarter"`

### Anti-slop
- `rule/inbox-no-dot`: When showing that a notice is unread, pass `read: false` and leave the row's 10px mark and its words to say it, instead of a coloured dot, because a dot is the mark the system leaves out, and the row's mark is a rounded square with "Unread" read beside it. Evidence: person D46; principle wcag: 1.4.1 use of color. Check: test `inbox.test.tsx` counts the marks and the "Unread" words.
  - Don't: `text: <><span className="size-2 rounded-full bg-primary" /> Calder filed a 13F</>`
  - Do: `{ text: "Calder Global Equity filed a 13F", read: false }`

### Limits
- `rule/inbox-list-cap`: When the inbox holds more than 50 notices, pass the newest 50 and link to a notifications page with `InboxList`, instead of the whole history, because the panel shows about six rows in its 448px and a person reading the bell reads the latest. Evidence: measured a 448px scroller and 74px rows, `.design-system/evidence/inbox/read-1440.json`. Check: review.
  - Don't: `<Inbox notices={allNotices} />`
  - Do: `<Inbox notices={allNotices.slice(0, 50)} />`

## Accessibility
Rests on IconButton for the bell, Popover (a Sheet on a phone) for the panel, a section per day named by its heading, Item rows that are links or buttons, and StateButton.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Enter, Space | the bell | opens the panel | the panel's first control | by hand |
| Tab | the panel | moves through All and Unread, Mark all read, then the rows | the next control | by hand |
| Left arrow, Right arrow | All or Unread | moves the view | the other choice | by hand |
| Enter | a row | opens the notice; the panel closes | the host's focus after a route change | by hand |
| Escape | the panel | closes it | the bell | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| bell | button | "Notifications", with the count, "Notifications, 3 unread" | `aria-expanded` while open | "Notifications, 3 unread, button, collapsed" | test |
| badge | none, `aria-hidden` | none | none | nothing; the name carries the count | test |
| panel | dialog | `aria-label` "Notifications" | none | "Notifications, dialog" | by hand |
| day | region | its heading, "Today" | none | "Today, region" | test |
| row | link or button | "Unread, " and the sentence, then the time | none | "Unread, Calder Global Equity filed a 13F, 2 hours ago, link" | test |
| loading list | list | "Loading notifications" | `aria-busy="true"` | "Loading notifications, busy" | test |
| failed | alert | its words | none | "Notifications did not load", once | test |
| Mark all read | button | its label | `aria-busy` while marking | "Marking", then "Marked" | by hand |

## Tokens
| Part | State | Token |
|---|---|---|
| bell's count | all | `--primary`, `--primary-foreground`, `--r-tag` |
| panel | all | `--popover`, `--r-3xl`, `--pad-card-sm`, `--shadow-floating` |
| row | unread | `--foreground`, `--primary`, `--r-xs` |
| row | read | `--muted-foreground` |
| row | hover, pressed | `--muted`, `--hover`, `--t-press`, `--curve` |
| day heading, time | all | `--muted-foreground` |
| failed | all | `--destructive` through Empty's alert words |

## Related
- Toast: what happened because of what the person just did.
- Alert: a condition of the page they are on.
- Sidebar: the frame whose header holds the bell; a place in the sidebar can carry the same count.
- Item: the row.
