# Live line

A step running now: its words shimmer, its time counts beside them, and both settle in one frame when it ends.

Live variants: https://design.arcadia.is/components/live-line

```tsx
import { Elapsed } from "@arcadia/ui";
```

```tsx
import { Collapsible, CollapsibleHeader, Elapsed } from "@arcadia/ui";

function Trail() {
  const run = useRun(5200, 2600);
  const think = useRun(3400, 3000);
  const done = run.until !== undefined;
  return (
    <div {...sx("cmp-stream", cmp.stream)}>
      <Collapsible step tone={think.until !== undefined ? "muted" : "neutral"} loading={think.until === undefined} expandable={false}>
        <CollapsibleHeader action={think.until !== undefined ? "Thought for" : "Thinking"} details={think.until !== undefined ? `${Math.max(1, Math.round((think.until - think.since) / 1000))}s` : undefined}
          figure={think.until === undefined ? <Elapsed since={think.since} /> : undefined} />
      </Collapsible>
      <Collapsible step tone="muted" expandable={false}>
        <CollapsibleHeader action="Read" details="src/math.ts" figure="120 lines" />
      </Collapsible>
      <Collapsible step tone={done ? "muted" : "neutral"} loading={!done} expandable={false}>
        <CollapsibleHeader action={done ? "Ran" : "Running"} details="Math tests" figure={<Elapsed since={run.since} until={run.until} />} />
      </Collapsible>
    </div>
  );
}
```

## Accessibility

The readout is plain text with no live region, so a screen reader is not told every second. Announce the change of step from the status container instead. Under reduced motion the sweep stops and the label rests in its tone colour; the time keeps counting, since it is the value, not a movement.

## API reference

### Elapsed

- `since` (`number`): When the step began, in epoch ms: the readout counts from here once a second.
- `until` (`number`): When it ended: the time stops here, in the same frame its line settles. Omit while it runs.
- `ms` (`number`): A time the caller measured on its own clock (paused spans left out): shown as given, never ticking.
- `format` (`(ms: number) => string`): Writes the time. Default `fmtMs`: "4s", "1m 12s".
- `rootStyle` (`RootStyle`): A component's typed override prop: `Layout` and its documented knobs, each the references it takes or another kit knob of its kind; anything else is a type error at the call site (STYLEX.md).

Rest props go to `HTMLAttributes<HTMLSpanElement>`.
