# Status dot

The one mark for a run's state, queued, running, waiting on you, done, failed or stopped, at four sizes, so a plan, a log and an inbox read the same.

Tier: free. Type: component. Category: feedback. Tags: run, agent, motion.

## Install

```bash
npx shadcn@latest add https://pixilui.com/r/status-dot.json
```

One-time setup: add the registry to `components.json`:

```json
{
  "registries": {
    "@pixilui": "https://pixilui.com/r/{name}.json"
  }
}
```

Files: `components/pixilui/status-dot.tsx`.

## Preview

Live preview: https://pixilui.com/components/status-dot

Knobs:

- `state`: `running`, `queued`, `waiting`, `done`, `failed`, `stopped`
- `size`: `md`, `dot`, `sm`, `lg`

Signature: Leave Running and the spinner never snaps back to the top: it slows to a stop from its own angle while the ring closes, then fills inward into the check.

Styles: `lively` (default), `quiet`, set with `data-style` on <html>. The item reads the style through the foundation; it needs no prop. Standalone files: lively https://pixilui.com/r/standalone/status-dot.tsx, quiet https://pixilui.com/r/standalone/status-dot.quiet.tsx.

## Code

`components/pixilui/status-dot.tsx`

```tsx
"use client";

/*
  The status node, locked 28 Nov 2026 (design/explorations/components/locked/status-dot). Its look and
  motion are foundation.css section 8 (.pixilui-status-node); this component writes the locked markup
  and plays a change the way the locked script does:

  Color     goes first, 150ms.
  Arc       leaving the spinner, the ring keeps its angle and slows to a stop from the spinner's speed
            while it grows into the ring (520ms on the out curve); entering it, the first half turn
            speeds up from rest. The ring's length follows the state or the progress in 520ms.
  Results   done and failed fill the ring inward (snappy spring, 140ms in), the flat disc takes over and
            the check or exclamation draws; failed shakes once. Stopped sets its square.
  Glows     waiting breathes a halo; a running dot sends out a ripple. They fade in and out over 300ms.
  Rest      one-shot motion plays only after a real change (data-changed), never on first render.
  Reduced   no loops, results drawn, changes instant.
*/

import { forwardRef, useCallback, useLayoutEffect, useRef, useState, type ComponentPropsWithoutRef, type CSSProperties } from "react";
import { cn } from "./lib/utils";
import { prefersReducedMotion } from "./lib/motion/reduced-motion";
import { safeAnimate } from "./lib/motion/animate";

export type StatusDotState = "queued" | "running" | "waiting" | "done" | "failed" | "stopped";
export type StatusDotSize = "dot" | "sm" | "md" | "lg";

export type StatusDotProps = Omit<ComponentPropsWithoutRef<"span">, "children"> & {
  /** The run's state. Changing it plays the change: the color first, then the shape carries on from where it was. */
  state: StatusDotState;
  /** dot 8 (log rows, table cells), sm 12, md 14 (lists), lg 16 (plans beside 14/20 titles). */
  size?: StatusDotSize;
  /** Share done, 0 to 100. Running and waiting draw an arc at it; running without it is a plain spinner. */
  progress?: number;
  /**
   * The node's accessible name when it stands alone, such as "Waiting on you". Leave it out when words sit
   * beside the node: it is then hidden from assistive tech and the words carry the state.
   */
  label?: string;
  /** A still copy: no loops, results drawn. */
  frozen?: boolean;
};

/** The mark (sm, md, lg): the locked 16-unit drawing, one ring for the run. */
function Mark() {
  return (
    <svg viewBox="0 0 16 16" aria-hidden="true">
      <circle className="pixilui-status-node-track" cx="8" cy="8" r="6.25" />
      <circle className="pixilui-status-node-ring" cx="8" cy="8" r="6.25" pathLength={100} />
      <rect className="pixilui-status-node-square" x="5.75" y="5.75" width="4.5" height="4.5" rx="1.1" />
      <circle className="pixilui-status-node-disc" cx="8" cy="8" r="7.15" />
      <path className="pixilui-status-node-check" pathLength={1} d="M5.2 8.2 7.1 10.05 10.8 6.3" />
      <path className="pixilui-status-node-bang" pathLength={1} d="M8 4.85V8.6" />
      <circle className="pixilui-status-node-bang-dot" cx="8" cy="11" r=".95" />
    </svg>
  );
}

/**
 * Leaving the spinner: reads the arc's angle now (before the state changes), and returns the move that
 * lets it slow to a stop from there while it grows into the ring, starting at the spinner's speed.
 */
function settle(el: HTMLElement, next: StatusDotState) {
  const ring = el.querySelector<SVGElement>(".pixilui-status-node-ring");
  if (!ring || el.dataset.state !== "running" || "progress" in el.dataset || next === "running" || next === "queued" || prefersReducedMotion() || typeof DOMMatrixReadOnly === "undefined") return null;
  const m = new DOMMatrixReadOnly(getComputedStyle(ring).transform);
  const a0 = (Math.atan2(m.b, m.a) * 180) / Math.PI;
  return () => {
    const cs = getComputedStyle(el);
    const dur = parseFloat(cs.getPropertyValue("--pixilui-status-node-arc"));
    const turn = parseFloat(cs.getPropertyValue("--pixilui-status-node-turn"));
    const ease = cs.getPropertyValue("--pixilui-ease-out").trim();
    const [x1, y1] = (ease.match(/[\d.]+/g) ?? [".23", "1"]).map(Number) as [number, number];
    const travel = ((360 / turn) * dur) / (y1 / x1);
    safeAnimate(ring, [{ transform: `rotate(${a0}deg)` }, { transform: `rotate(${a0 + travel}deg)` }], { duration: dur, easing: ease });
  };
}

/** The one mark for a run's state: queued, running, waiting on you, done, failed or stopped, at four sizes. */
export const StatusDot = forwardRef<HTMLSpanElement, StatusDotProps>(function StatusDot({ state, size = "md", progress, label, frozen, className, style, ...props }, forwarded) {
  const ref = useRef<HTMLSpanElement | null>(null);
  // data-state is written once by React; every later change goes through the effect, which reads the
  // spinner's angle before the state moves on (as the locked StatusNode.set does).
  const [first] = useState(state);
  const setRef = useCallback(
    (el: HTMLSpanElement | null) => {
      ref.current = el;
      if (typeof forwarded === "function") forwarded(el);
      else if (forwarded) forwarded.current = el;
    },
    [forwarded],
  );
  useLayoutEffect(() => {
    const el = ref.current;
    if (!el || el.dataset.state === state) return;
    const carry = settle(el, state);
    el.dataset.changed = "";
    el.dataset.state = state;
    carry?.();
    if (state === "failed" && !prefersReducedMotion()) {
      delete el.dataset.shake;
      void el.offsetWidth;
      el.dataset.shake = "";
    }
  }, [state]);
  const hasProgress = progress != null;
  return (
    <span
      ref={setRef}
      className={cn("pixilui-status-node", className)}
      data-state={first}
      data-size={size === "md" ? undefined : size}
      data-progress={hasProgress ? "" : undefined}
      data-frozen={frozen ? "" : undefined}
      style={hasProgress ? ({ "--pixilui-status-node-progress": progress, ...style } as CSSProperties) : style}
      {...(label ? { role: "img", "aria-label": label } : { "aria-hidden": true })}
      {...props}
    >
      {size === "dot" ? <span className="pixilui-status-node-core" /> : <Mark />}
    </span>
  );
});
```

## Usage

When to use:

- Beside a run's name in a plan, a timeline, a list or an inbox (md 14, lg 16).
- In tight places, log rows, table cells and nav counts, as the 8px dot (size="dot").
- Running or waiting with a known share done: pass progress and the ring draws it.

When not to use:

- A pill that also says the state in words: use Agent status, which is this node inside a pill.
- Presence on a person: use the avatar's status.
- Decoration: every node means a run's state.

```tsx
import { StatusDot, type StatusDotState } from "@/components/pixilui/status-dot";

// The first option of each knob is the demo's default; the docs preview starts there.
export const knobs = {
  state: ["running", "queued", "waiting", "done", "failed", "stopped"],
  size: ["md", "dot", "sm", "lg"],
} as const;

const runs: { name: string; words: Record<StatusDotState, string> }[] = [
  { name: "Refund ticket 4471", words: { queued: "Queued", running: "Checking the order", waiting: "Waiting on you", done: "Refunded $86.40", failed: "Stripe declined", stopped: "Stopped by Lena" } },
  { name: "Weekly churn digest", words: { queued: "Queued", running: "Reading 2,318 events", waiting: "Needs a date range", done: "Sent to 14 people", failed: "Warehouse timed out", stopped: "Stopped" } },
  { name: "Migrate billing tables", words: { queued: "Queued", running: "Step 3 of 7", waiting: "Approve the schema change", done: "7 of 7 steps", failed: "Lock held by deploy 912", stopped: "Stopped at step 4" } },
];

/** Three runs in a list, each with its node beside its words; the state knob changes all three at once so the change can be watched. */
export default function StatusDotDemo({ state = "running", size = "md" }: KnobValues<typeof knobs>) {
  const shown: StatusDotState = state;
  return (
    <ul className="flex w-full max-w-sm flex-col rounded-panel bg-surface p-2 elevation-raised">
      {runs.map((run, i) => (
        <li key={run.name} className="flex items-center gap-3 rounded-control px-3 py-2.5">
          <StatusDot state={shown} size={size} progress={shown === "running" && i === 2 ? 43 : undefined} />
          <span className="flex min-w-0 flex-col">
            <span className="type-label truncate text-foreground">{run.name}</span>
            <span className="type-caption truncate text-muted">{run.words[shown]}</span>
          </span>
        </li>
      ))}
    </ul>
  );
}
```

## Examples

None.

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `state` (required) | `"queued" \| "running" \| "waiting" \| "done" \| "failed" \| "stopped"` |  | The run's state. Changing it plays the change: the color first, then the shape carries on from where it was. |
| `size` | `"dot" \| "sm" \| "md" \| "lg"` | `"md"` | dot 8 (log rows, table cells), sm 12, md 14 (lists), lg 16 (plans beside 14/20 titles). |
| `progress` | `number` |  | Share done, 0 to 100. Running and waiting draw an arc at it; running without it is a plain spinner. |
| `label` | `string` |  | The node's accessible name when it stands alone, such as "Waiting on you". Leave it out when words sit beside the node: it is then hidden from assistive tech and the words carry the state. |
| `frozen` | `boolean` |  | A still copy: no loops, results drawn. |

Also accepts every native `<span>` attribute, and a ref to it.

## Keyboard

- `Tab`: Never takes focus: the node is not interactive. Focus the row or link it sits in.

## Accessibility

- Beside words the node is aria-hidden and the words carry the state.
- Alone, pass label: it becomes role="img" with that name; change the label with the state.
- Live regions belong to the place that changes (a row's words, a Live tag), never the node.
- Never color alone: every state has its own shape at every size (dashes or hollow, spinner or ripple, halo, check, exclamation, square).

## Motion

- Color goes first (150ms), then the shape carries on from where it was.
- Leaving running, the spinner keeps its angle and slows to a stop while it grows into the ring (520ms); entering it, the first half turn speeds up from rest.
- Done and failed fill the ring inward on the snappy spring, then the check or exclamation draws; failed shakes once. Stopped sets its square in 300ms.
- Waiting breathes a halo (1800ms); a running dot sends out a ripple. One-shot motion plays only after a real change, never on first render.
- Reduced motion: no loops, results drawn, changes instant.

## Responsive

- A fixed box per size (8, 12, 14, 16); it never stretches.

## Performance

- The look and motion are CSS in the foundation (section 8); the component writes attributes and reads one transform when leaving the spinner.

## Notes for AI

- <StatusDot state="running" /> beside the run's words. States: queued, running, waiting (on the person), done, failed, stopped.
- Sizes: dot 8 (logs, tables), sm 12, md 14 (lists, the default), lg 16 (plans).
- Keep the same element and change state: the change plays from where the node is (the spinner's angle carries). Re-keying it skips the motion.
- Pass progress (0 to 100) for running or waiting with a known share done.
- Alone with no words beside it, pass label ("Waiting on you"); otherwise leave it out.
- Agent status, the run's pill, is this node inside a pill: use that when the words go in the pill.

## Related

- [Agent status](https://pixilui.com/components/agent-status/markdown): A run's live state in a pill, queued, running, waiting on you, done, failed or stopped, that fills as it goes and closes into its result.
- [Badge](https://pixilui.com/components/badge/markdown): A fixed fact about a run as a tag, a badge inline in a table, or a small count beside a name, in the locked status colors with solid icons cut from the free Hugeicons.
