# Delta

A change with its arrow, its baseline and a hue only where one direction is good.

Live variants: https://design.arcadia.is/components/delta

```tsx
import { Delta, fmtDelta, fmtCount, fmtMs } from "@arcadia/ui";
```

A change written once: its sign and the kit's arrow before the number, and what it is measured against after it.

- Up
- Down
- No change

## Accessibility

The arrow and the sign are drawn for the eye. A screen reader hears the direction in words, then the baseline: "up 12% from last week", "down 3.2% from yesterday", "no change from last month". Copied, the change reads as it is drawn, "+12% from last week".

Colour is never the only key. A judged change keeps its arrow, its sign and its words, so it reads the same in a grey screenshot; both hues hold 4.5:1 on every surface a chart sits on, in both themes.

## API reference

### Delta

- `value` (`number`, required): A share of what it is measured against (`0.12` is +12%), or with `format` an amount.
- `baseline` (`string`): What it is measured against, in words: "from last week".
- `polarity` (`"up" | "down"`): The direction that is good, in the success hue; the other takes the danger hue. Unset, both are ink.
- `format` (`(n: number) => string`): `fmtCount` for a count, `fmtMs` for a duration.
- `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>`.
