# Status dot

One 14px status slot for chat rows (unread dot, attention mark, run marks, and Stated) or a state in Caption words, alongside LastHeard for work records.

Live variants: https://design.arcadia.is/components/status-dot

```tsx
import {
  StatusDot, LastHeard, isLastHeard, lastHeardClock, lastHeardText,
} from "@arcadia/ui";
```

```tsx
import { ListRow, StatusDot } from "@arcadia/ui";

<div {...sx("cmp-rows", cmp.rows)}>
  <ListRow
    leading={<StatusDot status="running" />}
    label="Preferences dialog"
    meta="now"
  />
  <ListRow
    leading={<StatusDot status="attention" />}
    label="Plan the onboarding flow"
    meta="4m"
  />
  <ListRow
    leading={<StatusDot status="unread" />}
    label="Quarterly report"
    meta="13h"
  />
  <ListRow
    leading={<StatusDot status="error" />}
    label="Fix the flaky upload test"
    meta="16h"
  />
  <ListRow
    leading={<StatusDot status="idle" />}
    label="Colour tokens"
    meta="2d"
  />
  <ListRow leading={<StatusDot status="draft" />} label="New chat" meta="3d" />
</div>
```

The attention dot, the unread dot and a read line with no light, in a list's margin in each theme.

```tsx
<Cell caption="At night"><Lights theme="dark" /></Cell>
<Cell caption="By day"><Lights theme="light" /></Cell>
```

- At night
- By day

## Accessibility

A dot is decorative unless given a `label`, which makes it an `img` with that name. Colour alone never carries the status: say it in the row's text, its `aria-label`, or the dot's `label` ("Unread").

`status="attention"` is an `img` named "Waits for your answer" wherever it stands without `children`, read as part of a row's name in its `light`; give it `label={null}` where the words beside it say so already, and it is hidden from readers. It is the plain dot in the attention amber, never a glyph, so its name and tooltip tell it from the unread dot. Under forced colours both are drawn in the system's ink.

Without `children`, the mark inherits the surrounding text role's line height (Body 20px on rows, Caption 16px beside Caption text). A `StatusDot` with `children` sets Caption and reads as its word. With `why` it is a stop of its own, so the keyboard shows the tooltip a pointer does, and the why is its description; `role` announces a change of state.

## API reference

### StatusDot

- `status` (`"idle" | "unread" | "attention" | "error" | "draft" | "running" | "waiting" | "blocked" | "done" | "stopped" | "skipped" | "stated"`, default `"idle"`)
- `tone` (`"success" | "warning" | "danger" | "muted" | "neutral"`): The state of a thing that is not a run or a chat (a connector's Off, Needs trust, Can't connect), beside the word that names it: a steady dot in the tone's ink, never a pop or a glyph. Set, it stands in for `status`.
- `label` (`string | null`): Accessible name ("Unread"). For `attention` without `children`, defaults to "Waits for your answer"; pass `null` where the words beside it say so already. Omit on other statuses when stated in text.
- `enter` (`boolean`): Pops in once on mount (a badge on an avatar, a row's unread dot, a line that starts to wait). A later change into `unread`, `attention` or `error` pops on its own. Never under reduced motion, `data-instant` or a hidden page.
- `busy` (`boolean`, default `false`): Shows the text-sized loader in the mark's seat when `children` is set.
- `why` (`string`): Tooltip for a labelled state, reached by keyboard focus too.
- `rootStyle` (`RootStyle<StatusDotKnobs>`): Typed StyleX override: layout and the `--status-dot-*` knobs.
- `children` (`ReactNode`): Caption words beside the mark (a state in words). For `status="stated"`, defaults to "Stated".

Rest props go to `<span>` props and `render`.

### LastHeard

- `at` (`number`, required): When the holder was last heard, in milliseconds.
- `now` (`number`, default `Date.now()`): Reference time in milliseconds, to tell today from an earlier day.
- `rootStyle` (`RootStyle`): Typed StyleX override: where it sits.

Rest props go to `<span>` props.
