# Progress ring

A determinate 14px ring (the context meter) that warms to yellow and red.

Live variants: https://design.arcadia.is/components/progress-ring

```tsx
import { ProgressRing, ProgressRingGlyph } from "@arcadia/ui";
```

The context meter in a composer's footer. Use more steps it through its levels: yellow from 60%, red from 85%.

```tsx
import { useState } from "react";
import { Button, ProgressRing } from "@arcadia/ui";

function ContextProgress() {
  const [used, setUsed] = useState(0.42);
  return (
    <>
      <Button
        size="sm"
        onClick={() => setUsed((u) => (u >= 0.9 ? 0.18 : Math.min(0.96, u + 0.22)))}
      >
        Use more
      </Button>
      <span {...stylex.props(page.context)}>
        <span aria-hidden="true" {...stylex.props(page.contextValue)}>{Math.round(used * 100)}%</span>
        <ProgressRing
          value={used}
          label="Context used"
          valueText={`${Math.round(used * 200)}k of 200k tokens`}
        />
      </span>
    </>
  )
```

## Accessibility

With a `label` the ring is a `meter` with its value, range and `valueText` (default: the rounded percentage), so "Context used, 122k of 200k tokens" is read instead of a bare number. Without a label it is decorative, for use inside a labelled button. The levels are colour only, so say "almost full" in the `valueText` or a tooltip when it matters.

Forced colours leave a stroke in the page's own ink, so under them the arc takes the system's highlight and the track its grey text: how far the ring is still shows, in every palette, though its levels do not.

## API reference

### ProgressRing

- `value` (`number`, required): Fraction filled, 0..1 (clamped).
- `size` (`"sm" | "md" | "lg" | "text"`, default `"md"`): 12 / 14 / 16 px, or `text`: in an icon's slot, the size and stroke of the icon of the text style it stands in. The context meter.
- `level` (`"normal" | "warm" | "hot"`): Colour level. Default: derived from `value` with `warmAt` / `hotAt`.
- `warmAt` (`number`, default `0.6`): Yellow from here.
- `hotAt` (`number`, default `0.85`): Red from here.
- `label` (`string`): Accessible name ("Context used"). With a label the ring is a `meter` (value, min, max and `valueText`); without one it is decorative, for use inside a labelled button.
- `valueText` (`string`): Spoken value, e.g. "61k of 1,008k tokens". Default: the rounded percentage.
- `mark` (`number`): A tick at this fraction, 0..1.
- `filled` (`boolean`, default `false`): The value as a filled sector inside the track, not an arc on it: a meter at rest that never reads as a spinner.
- `rootStyle` (`RootStyle<ProgressRingKnobs>`): Typed StyleX override: layout and the `--progress-ring-*` knobs.

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