# StatusDot (/docs/charts/status-dot)

StatusDot prints one mark for one state: a filled circle for `ok`, a triangle for `warn`, a diamond for `error`, a
hollow ring for `off`, a half-filled circle for `busy`. Every state pairs a distinct silhouette with a semantic color,
so the five stay distinct in grayscale, in print, and in forced-colors, where color-only dots all render as the same
gray circle. That pairing is also what keeps two states from collapsing into the same mark for the 1-in-12 colorblind
readers a colored disc fails.

```tsx
<span className="text-lg">
  {"The API is "}
  <StatusDot status="ok" title="API" style={{ width: "0.6em", height: "0.6em" }} />
  {" operational."}
</span>
```

## Install

```tsx
import { StatusDot } from "@microcharts/react/status-dot";

<StatusDot status="ok" title="API" />
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.

## Try it

```tsx
import { StatusDot } from "@microcharts/react/status-dot/interactive";

<StatusDot
  status="ok"
/>
```

## When to use it

Use it for service lists, inline state in a sentence, and monitoring rows. It carries no quantity and no trend, and past
~6 states the marks stop being memorable.

## The state contract

| status  | glyph              | token           |
| ------- | ------------------ | --------------- |
| `ok`    | filled circle      | `--mc-positive` |
| `warn`  | triangle           | `--mc-cat-1`    |
| `error` | diamond            | `--mc-negative` |
| `off`   | hollow ring        | `--mc-neutral`  |
| `busy`  | half-filled circle | `--mc-accent`   |

The pairing is a contract: `color` recolors a state but never reshapes it, and a theme must never let two states share a
silhouette.

## Sizing

**inline in a sentence**

```tsx
// em-sized, it sits on the text midline
The API is <StatusDot status="ok" style={{ width: "0.6em", height: "0.6em" }} /> operational.
```

**custom vocabulary**

```tsx
<StatusDot
  status="degraded"
  states={{ degraded: { glyph: "triangle", token: "--mc-cat-1", label: "degraded" } }}
/>
```

## Variants

```tsx
// "this state is live" — monitoring contexts; gated on reduced motion
<StatusDot status="ok" pulse />
```

```tsx
<StatusDot
  status="degraded"
  states={{ degraded: { glyph: "triangle", token: "--mc-cat-1", label: "degraded" } }}
/>
```

## Edge cases

```tsx
// no "degraded" entry in the built-in map, and none supplied via `states`
<StatusDot status="degraded" />
```

An unknown status key renders the `off` ring and logs a dev warning, so a typo never renders as a plausible-looking
wrong state.

## Four homes

**In a sentence**

```tsx
<p>
  Checkout is{" "}
  <span className="mc-inline">
    <StatusDot status="ok" style={{ width: "0.7em", height: "0.7em" }} summary={false} />
  </span>{" "}
  operational; Billing is{" "}
  <span className="mc-inline">
    <StatusDot status="warn" style={{ width: "0.7em", height: "0.7em" }} summary={false} />
  </span>{" "}
  degraded.
</p>
```

**In a table cell**

```tsx
<td>
  <StatusDot status="warn" />
</td>
```

**In a KPI card**

```tsx
<div className="kpi">
  <span className="figure">2 / 5</span>
  <span className="unit">fully healthy</span>
  <StatusDot status="ok" />
  <StatusDot status="warn" />
  <StatusDot status="error" />
  <StatusDot status="ok" />
  <StatusDot status="off" />
</div>
```

**In a tab header**

```tsx
<button className="tab">
  Staging <StatusDot status="busy" pulse />
</button>
```

## Accessibility

The accessible name is the state's label, **"Status: ok."**, composed with your `title` to read "API. Status: ok.". The
interactive entry announces state changes through a polite live region and stays quiet on mount. `pulse` is a CSS halo
that disappears entirely under `prefers-reduced-motion`.

This chart is a single unit, so there is nothing to rove between: a click, tap, `Enter` or `Space` selects it
and fires `onSelect`, and no selection stays pinned. That is the scalar half of the shared
[interaction contract](/docs/accessibility#one-interaction-contract).

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `status` (required) | `string` | Built-in ok \| warn \| error \| off \| busy, or a key of states. |
| `pulse` | `boolean` | Live-now halo (reduced-motion-gated). |
| `states` | `Record<string, { glyph; token; label }>` | Extend the vocabulary; the shape+color pairing is preserved. |
| `color` | `string` | Recolors the active state; never reshapes it. |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
