

# ProgressCircle

A ring that fills as an operation advances, or spins while the amount of work is unknown. It carries the same `role="progressbar"` semantics as [ProgressBar](/components/progress-bar), in a square footprint.

Use it where a bar will not fit: inside a button or card, in a table cell, on a dashboard tile. To show a measurement that is not a task (disk usage, a score), use [Meter](/components/meter). For a wait with nothing to measure and no label, [Spinner](/components/spinner) is lighter.

## Examples

### Default

`value` runs from `min` (0) to `max` (100), as on the native `<progress>`. `label` is the accessible name; the ring has no visible text of its own.

```tsx
import { ProgressCircle } from '@var-ui/react';

<ProgressCircle label="Uploading assets" value={64} />
```

```astro
---
import { ProgressCircle } from '@var-ui/astro';
---

<ProgressCircle label="Uploading assets" value={64} />
```

```html
<!-- No HTML demo yet: use @var-ui/react -->
```

### Indeterminate

Leave `value` out (or pass `indeterminate`) when the amount of work is unknown. The ring spins a fixed arc and drops `aria-valuenow`. Under `prefers-reduced-motion` the spin stops and the arc stays visible.

```tsx
import { ProgressCircle } from '@var-ui/react';

<ProgressCircle label="Loading" />
```

```astro
---
import { ProgressCircle } from '@var-ui/astro';
---

<ProgressCircle label="Loading" />
```

```html
<!-- No HTML demo yet: use @var-ui/react -->
```

### Sizes

`size` is `sm`, `md` (default) or `lg`. The stroke thickness scales with the size, set through `--var-ui-progress-circle-size` and `--var-ui-progress-circle-thickness`.

```tsx
import { HStack, ProgressCircle } from '@var-ui/react';

<HStack gap="md" align="center">
  <ProgressCircle label="Small" value={40} size="sm" />
  <ProgressCircle label="Medium" value={40} size="md" />
  <ProgressCircle label="Large" value={40} size="lg" />
</HStack>
```

```astro
<!-- No Astro demo for this variant: see the Astro peer in the page text -->
```

```html
<!-- No HTML demo yet: use @var-ui/react -->
```

### With a centered label

`children` render inside the ring. Pass a function to receive the `percentage` (0 to 100) and the formatted `valueText`. The text is presentational: the accessible value is still the progressbar's `aria-valuetext`, so use `valueLabel` for a custom spoken value such as "Step 3 of 4".

```tsx
import { ProgressCircle } from '@var-ui/react';

<ProgressCircle label="Uploading assets" value={72} size="lg">
  {({ valueText }) => valueText}
</ProgressCircle>
```

```astro
---
import { ProgressCircle } from '@var-ui/astro';
---

<ProgressCircle label="Uploading assets" value={72} size="lg">72%</ProgressCircle>
```

```html
<!-- No HTML demo yet: use @var-ui/react -->
```

### Tones and appearance

`tone` colors the arc (`accent` by default) and `appearance="subtle"` tints the track from the same color.

```tsx
import { HStack, ProgressCircle } from '@var-ui/react';

<HStack gap="md" align="center">
  <ProgressCircle label="Accent" value={60} />
  <ProgressCircle label="Success" value={60} tone="success" />
  <ProgressCircle label="Warning" value={60} tone="warning" />
  <ProgressCircle label="Danger" value={60} tone="danger" />
  <ProgressCircle label="Neutral" value={60} tone="neutral" appearance="subtle" />
</HStack>
```

```astro
<!-- No Astro demo for this variant: see the Astro peer in the page text -->
```

```html
<!-- No HTML demo yet: use @var-ui/react -->
```

## Astro

`ProgressCircle` from `@var-ui/astro` renders the same DOM and classes. The default slot is the centered content. It takes the same props except the render-function `children` and `formatOptions`; the percentage is computed once at render.

## Styling hooks

The arc length follows `--var-ui-progress-circle-progress`, a number from 0 to 1 set inline on the ring (`.var-ui-progress-circle__ring`). The ring is an SVG with `pathLength="100"`, so the dash length is the percentage. Slots: `root`, `ring`, `track`, `fill`, `content`.

## Props

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| appearance | "solid" \| "subtle" \| undefined | no | "solid" |  |
| children | ((state: { percentage: number; valueText: string; }) => ReactNode) \| ReactNode | no |  | Content centered inside the ring, e.g. the percentage. Receives the formatted value. |
| formatOptions | NumberFormatOptions \| undefined | no | `{ style: 'percent' }` | `Intl.NumberFormat` options for the spoken value. |
| indeterminate | boolean \| undefined | no | false |  |
| label | string \| undefined | no |  | Accessible name (`aria-label`). Required unless `aria-label` / `aria-labelledby` is set. |
| max | number \| undefined | no | 100 |  |
| min | number \| undefined | no | 0 |  |
| size | "lg" \| "md" \| "sm" \| undefined | no | "md" |  |
| style | CSSProperties \| undefined | no |  |  |
| tone | "accent" \| "danger" \| "info" \| "neutral" \| "success" \| "warning" \| undefined | no | "accent" |  |
| value | number \| undefined | no |  | Progress, between `min` and `max`. Leave it out (or pass `indeterminate`) when the amount of work is unknown. |
| valueLabel | string \| undefined | no |  | Spoken value (`aria-valuetext`), replacing the formatted percentage. |

## Accessibility

- Built on React Aria's `ProgressBar`: `role="progressbar"` with `aria-valuemin`, `aria-valuemax`, `aria-valuenow` and `aria-valuetext` (a percentage by default; set `formatOptions` or `valueLabel`).
- Indeterminate rings have no `aria-valuenow`.
- Give every ring a name with `label`, `aria-label` or `aria-labelledby`. The SVG is `aria-hidden`.
- Forced colors: the arc uses `Highlight` and the track `GrayText`, so both stay visible.
- Right-to-left: the ring sweeps counter-clockwise.
- The ring is not focusable and has no keyboard interaction.


> Also accepts all standard HTML attributes (ARIA attributes, event handlers, styles, …). Run `var-ui component progress-circle --all-props` for the complete list.
