# Progress

Shows how far a task has got, as a bar or a circle, determinate or indeterminate.

- Family: feedback
- Import: `import { ProgressBar, ProgressCircle } from "@senvenli/react/feedback";`
- Page: https://design.senvenli.com/docs/components/progress
- JSON: https://design.senvenli.com/docs/components/progress.json

## Example: A known length

The label says what is in progress; the value uses real units where they exist.

```tsx
import { ProgressBar } from "@senvenli/react/feedback";

export default function Example() {
  return <ProgressBar label="Importing contacts" value={142} maxValue={220} valueLabel="142 / 220" />;
}
```

## Examples

### Unknown length

A segment sweeps across while the task runs.

```tsx
import { ProgressBar } from "@senvenli/react/feedback";

export default function Example() {
  return <ProgressBar label="Preparing your export" isIndeterminate />;
}
```

### Finished and failed

`success` and `danger` close the task, each with a word in the value.

```tsx
import { ProgressBar } from "@senvenli/react/feedback";
import { Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Stack space="space-300">
      <ProgressBar label="Account setup" size="large" value={3} maxValue={5} valueLabel="3 / 5 steps" />
      <ProgressBar label="Importing contacts" tone="success" value={220} maxValue={220} valueLabel="Done · 220 contacts" />
      <ProgressBar label="Importing orders" tone="danger" value={64} maxValue={180} valueLabel="Failed at 64 / 180" />
    </Stack>
  );
}
```

### Circle

ProgressCircle, for places with no width to spare.

```tsx
import { Text } from "@senvenli/react/display";
import { ProgressCircle } from "@senvenli/react/feedback";
import { Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Stack direction="horizontal" space="space-400" align="end">
      <Stack direction="horizontal" space="space-100">
        <ProgressCircle size="small" value={40} aria-label="Uploading report" />
        <Text size="body-small" tone="subtle">Uploading 40%</Text>
      </Stack>
      <ProgressCircle value={72} label="Profile" />
      <ProgressCircle size="large" value={86} label="Seats in use" isMeasurement />
      <ProgressCircle isIndeterminate aria-label="Syncing orders" />
    </Stack>
  );
}
```

## Guidelines

### When to use it

- A task takes a while and its progress is known or ongoing.

### Use something else when

- [spinner](https://design.senvenli.com/docs/components/spinner.md): Something short is loading.

## Accessibility

Built in:

- Exposed as a progressbar with its value text.

You provide:

- A `label` that says what is in progress.

## API reference

### ProgressBar

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| label | `React.ReactNode` |  | yes | What is in progress ("Importing contacts"). |
| value | `number` |  | no |  |
| minValue | `number` |  | no |  |
| maxValue | `number` |  | no |  |
| valueLabel | `React.ReactNode` |  | no | Real units where they exist ("142 / 220", "3 / 5 steps"); defaults to the percentage. |
| isIndeterminate | `boolean` |  | no | A task of unknown length: a 30% segment sweeps across. |
| tone | `ProgressTone` |  | no | `success` / `danger` for a finished or failed task; pair it with a word in `valueLabel`. |
| size | `"medium" \| "large"` |  | no | `medium` (4px, default); `large` (8px) for onboarding. |
| motion | `ComponentMotion` |  | no | `auto` (follow the device), `reduce` or `none`, for this component; the provider's setting otherwise. |

### ProgressCircle

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| value | `number` | `0` | no |  |
| minValue | `number` | `0` | no |  |
| maxValue | `number` | `100` | no |  |
| size | `ProgressCircleSize` | `"medium"` | no | 20px (no value text; give the value in adjacent text or a Tooltip), 48px, 80px. |
| label | `React.ReactNode` |  | no | A visible label under the ring, or `aria-label` when there is none. |
| aria-label | `string` |  | no |  |
| isIndeterminate | `boolean` |  | no |  |
| isMeasurement | `boolean` |  | no | A ratio that is a measurement (doluluk, kota), not progress: announced as a meter. |
| tone | `ProgressTone` | `"brand"` | no |  |
| valueLabel | `string` |  | no |  |

### Tokens it reads

`--ds-background-brand-bold`, `--ds-background-danger-bold`, `--ds-background-neutral`, `--ds-background-neutral-pressed`, `--ds-background-success-bold`, `--ds-easing-standard`, `--ds-radius-full`, `--ds-space-075`, `--ds-space-200`, `--ds-text`, `--ds-text-danger`, `--ds-text-subtlest`, `--ds-text-success`

## Related

- [spinner](https://design.senvenli.com/docs/components/spinner.md)
- [meter](https://design.senvenli.com/docs/components/meter.md)
