# Progress

A bar that shows how far a task has gone.

A bar that shows how far a task has gone: an upload, a build, a quota. A linear progress bar: a rounded track in the line colour and a range in a tone, with an optional label and value above it. The progress ring's line, laid flat: the same track colour, the same tones, the same travel when the value changes. Without a value it is indeterminate: a band sweeps along the track. Behaviour and ARIA from the Zag progress machine through Ark UI.

Kind: component · Category: Feedback · Status: beta · Targets: React, Vue, Svelte · Behaviour: Zag `progress` machine, through Ark UI

## Add

```bash
npx fndn add progress
```

It writes the folder `progress/` into the project's ui folder (`index.ts`, `progress.tsx`, `Progress.vue`, `Progress.svelte`, `progress.recipe.ts`). First time: [Installation](/installation.md).

## Usage

```tsx
import { Progress } from "@/components/ui/progress";
```

```vue
import { Progress } from "@/components/ui/progress";
```

```svelte
import { Progress } from "$lib/components/ui/progress";
```

## Parts

In the DOM the root carries `data-slot="progress"` and each part `data-slot="progress-<part>"`; in the recipe the root is the `base` slot and each part a slot named after it in camelCase.

| Part | Element | data-slot | Flags | Notes |
| --- | --- | --- | --- | --- |
| `root` | `div` | `progress` |  | Ark's progress root: data-state=loading\|complete\|indeterminate, --percent (0..100) for the range. A two-column grid: label at the start and value at the end on the first row, the track across both on the second. |
| `label` | `span` | `progress-label` | optional | What is progressing (12px/500 ink-2); it names the progress bar (aria-labelledby). Wraps, never cut; author text keeps its own direction. |
| `value` | `span` | `progress-value` | optional | Ark's value text ("42%", or the caller's formatted text): 12px ink-2, tabular figures, never wraps; aria-hidden (the progressbar already carries the value). |
| `track` | `div` | `progress-track` |  | role=progressbar with aria-valuemin, aria-valuemax and aria-valuenow (none while indeterminate), named by the label or by the label prop. Full width, rounded pill, color.line, clips the range. Indeterminate: its ::before is a band a quarter of the track wide that sweeps along it. |
| `range` | `div` | `progress-range` |  | The filled part: as wide as the track, rounded pill, in the tone; moved by translateX(percent - 100%) (mirrored right-to-left). Indeterminate: it waits out of sight at translateX(-100%), so a value that arrives only grows from the start. |

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `number` |  | Between min and max; out-of-range values are clamped. null (or omitted) is indeterminate. |
| `min` | `number` | `0` |  |
| `max` | `number` | `100` |  |
| `label` | `string` |  | Shown above the track at the start, and the progress bar's name. |
| `ariaLabel` | `string` | `"Progress"` | The progress bar's name when there is no visible label (aria-label). |
| `showValue` | `boolean` | `false` | Shows the value above the track at the end ("42%"; nothing while indeterminate). |
| `valueText` | `string` |  | The text shown as the value instead of the percentage ("3 of 8 files"); also aria-valuetext. |
| `tone` | `"orange" \| "green" \| "red" \| "accent"` | `"orange"` | The range's colour, as the progress ring. |
| `size` | `"sm" \| "md"` | `"md"` | The track's height: sm 4px, md 6px. |

Other attributes and `class` go to the root; `class` is merged through the recipe.

## States

`loading`, `complete`, `indeterminate`

## Keyboard and accessibility

Role: progressbar.

Notes:

- The track is the progressbar: aria-valuenow is the value (none while indeterminate), aria-valuemin / aria-valuemax the range, aria-valuetext the valueText when given.
- Give it a name that says what is progressing: the label (visible) or ariaLabel.
- The visible value is aria-hidden: the progressbar already announces it.

## Motion

- range: transform over duration.move easing.out-strong when the value changes (the ring's arc timing); jumps under prefers-reduced-motion
- indeterminate: a band (the track's ::before, never the range, so the range's transform never changes kind) sweeps along the track, 1.4s linear, looping (it is the loading signal, so it keeps moving under reduced motion, like the spinner)
- nothing animates on mount

## Tokens

`color.line`, `color.orange`, `color.green`, `color.red`, `color.accent`, `color.ink-2`, `radius.pill`, `text.xs`, `duration.move`, `easing.out-strong`

## Examples

### Build minutes this month

React · `build-minutes.tsx`

```tsx
import { Progress } from "@/components/ui/progress";

export default function BuildMinutes() {
  return <Progress className="w-full" value={2140} max={3000} label="Build minutes this month" showValue valueText="2,140 of 3,000 min" tone="accent" />;
}
```

Vue · `build-minutes.vue`

```vue
<script setup lang="ts">
import { Progress } from "@/components/ui/progress";
</script>

<template>
  <Progress class="w-full" :value="2140" :max="3000" label="Build minutes this month" show-value value-text="2,140 of 3,000 min" tone="accent" />
</template>
```

Svelte · `build-minutes.svelte`

```svelte
<script lang="ts">
  import { Progress } from "$lib/components/ui/progress";
</script>

<Progress class="w-full" value={2140} max={3000} label="Build minutes this month" showValue valueText="2,140 of 3,000 min" tone="accent" />
```

### Close to the plan’s limits

React · `plan-limits.tsx`

```tsx
import { Progress } from "@/components/ui/progress";

const meters = [
  { label: "Build minutes", value: 71, text: "2,140 of 3,000 min", tone: "accent" },
  { label: "Bandwidth", value: 92, text: "92 of 100 GB", tone: "orange" },
  { label: "Seats", value: 100, text: "12 of 12 seats", tone: "red" },
] as const;

export default function PlanLimits() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      {meters.map((meter) => (
        <Progress key={meter.label} value={meter.value} label={meter.label} showValue valueText={meter.text} tone={meter.tone} />
      ))}
    </div>
  );
}
```

Vue · `plan-limits.vue`

```vue
<script setup lang="ts">
import { Progress } from "@/components/ui/progress";

const meters = [
  { label: "Build minutes", value: 71, text: "2,140 of 3,000 min", tone: "accent" },
  { label: "Bandwidth", value: 92, text: "92 of 100 GB", tone: "orange" },
  { label: "Seats", value: 100, text: "12 of 12 seats", tone: "red" },
] as const;
</script>

<template>
  <div class="flex w-full max-w-sm flex-col gap-4">
    <Progress v-for="meter in meters" :key="meter.label" :value="meter.value" :label="meter.label" show-value :value-text="meter.text" :tone="meter.tone" />
  </div>
</template>
```

Svelte · `plan-limits.svelte`

```svelte
<script lang="ts">
  import { Progress } from "$lib/components/ui/progress";

  const meters = [
    { label: "Build minutes", value: 71, text: "2,140 of 3,000 min", tone: "accent" },
    { label: "Bandwidth", value: 92, text: "92 of 100 GB", tone: "orange" },
    { label: "Seats", value: 100, text: "12 of 12 seats", tone: "red" },
  ] as const;
</script>

<div class="flex w-full max-w-sm flex-col gap-4">
  {#each meters as meter (meter.label)}
    <Progress value={meter.value} label={meter.label} showValue valueText={meter.text} tone={meter.tone} />
  {/each}
</div>
```

### Uploading a file

React · `upload-file.tsx`

```tsx
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Progress } from "@/components/ui/progress";

export default function UploadFile() {
  const [value, setValue] = useState(0);
  const [running, setRunning] = useState(false);
  useEffect(() => {
    if (!running) return;
    const timer = setInterval(() => setValue((v) => Math.min(100, v + 7 + Math.round(Math.random() * 12))), 450);
    return () => clearInterval(timer);
  }, [running]);
  const done = value >= 100;
  return (
    <div className="flex w-full max-w-sm flex-col gap-3">
      <Progress value={value} label={done ? "Uploaded data-pipeline-2026-11.csv" : "Uploading data-pipeline-2026-11.csv"} showValue tone={done ? "green" : "accent"} />
      <Button size="sm" className="self-start" onClick={() => { setValue(0); setRunning(true); }}>{done || !running ? "Start upload" : "Restart"}</Button>
    </div>
  );
}
```

Vue · `upload-file.vue`

```vue
<script setup lang="ts">
import { computed, onBeforeUnmount, ref, watch } from "vue";
import { Button } from "@/components/ui/button";
import { Progress } from "@/components/ui/progress";

const value = ref(0);
const running = ref(false);
let timer: ReturnType<typeof setInterval> | undefined;
watch(running, (on) => {
  clearInterval(timer);
  if (on) timer = setInterval(() => (value.value = Math.min(100, value.value + 7 + Math.round(Math.random() * 12))), 450);
});
onBeforeUnmount(() => clearInterval(timer));
const done = computed(() => value.value >= 100);
function start() {
  value.value = 0;
  running.value = true;
}
</script>

<template>
  <div class="flex w-full max-w-sm flex-col gap-3">
    <Progress :value="value" :label="done ? 'Uploaded data-pipeline-2026-11.csv' : 'Uploading data-pipeline-2026-11.csv'" show-value :tone="done ? 'green' : 'accent'" />
    <Button size="sm" class="self-start" @click="start">{{ done || !running ? "Start upload" : "Restart" }}</Button>
  </div>
</template>
```

Svelte · `upload-file.svelte`

```svelte
<script lang="ts">
  import { Button } from "$lib/components/ui/button";
  import { Progress } from "$lib/components/ui/progress";

  let value = $state(0);
  let running = $state(false);
  $effect(() => {
    if (!running) return;
    const timer = setInterval(() => (value = Math.min(100, value + 7 + Math.round(Math.random() * 12))), 450);
    return () => clearInterval(timer);
  });
  const done = $derived(value >= 100);
</script>

<div class="flex w-full max-w-sm flex-col gap-3">
  <Progress {value} label={done ? "Uploaded data-pipeline-2026-11.csv" : "Uploading data-pipeline-2026-11.csv"} showValue tone={done ? "green" : "accent"} />
  <Button size="sm" class="self-start" onclick={() => { value = 0; running = true; }}>{done || !running ? "Start upload" : "Restart"}</Button>
</div>
```

### Preparing an export

React · `preparing-export.tsx`

```tsx
import { Progress } from "@/components/ui/progress";

export default function PreparingExport() {
  return <Progress className="w-full max-w-sm" label="Preparing invoices-2026.csv" />;
}
```

Vue · `preparing-export.vue`

```vue
<script setup lang="ts">
import { Progress } from "@/components/ui/progress";
</script>

<template>
  <Progress class="w-full max-w-sm" label="Preparing invoices-2026.csv" />
</template>
```

Svelte · `preparing-export.svelte`

```svelte
<script lang="ts">
  import { Progress } from "$lib/components/ui/progress";
</script>

<Progress class="w-full max-w-sm" label="Preparing invoices-2026.csv" />
```

### Steps of a migration

React · `migration-steps.tsx`

```tsx
import { Progress } from "@/components/ui/progress";

export default function MigrationSteps() {
  return <Progress className="w-full max-w-sm" value={3} max={8} label="Migrating the billing-api database" showValue valueText="3 of 8 tables" size="sm" />;
}
```

Vue · `migration-steps.vue`

```vue
<script setup lang="ts">
import { Progress } from "@/components/ui/progress";
</script>

<template>
  <Progress class="w-full max-w-sm" :value="3" :max="8" label="Migrating the billing-api database" show-value value-text="3 of 8 tables" size="sm" />
</template>
```

Svelte · `migration-steps.svelte`

```svelte
<script lang="ts">
  import { Progress } from "$lib/components/ui/progress";
</script>

<Progress class="w-full max-w-sm" value={3} max={8} label="Migrating the billing-api database" showValue valueText="3 of 8 tables" size="sm" />
```

## Recipe

`progress.recipe.ts`:

```ts
import { tv, type VariantProps } from "../lib/tv";

/* progress — a linear progress bar (Zag progress through Ark UI). The model is the progress ring:
 * the same track colour (line), the same tones (orange by default), the same travel when the value
 * changes (duration.move, easing.out-strong). Sizes have no model: sm 4px, md 6px.
 *
 * The engine writes --percent (0..100) on the root and a width on the range. The range is kept as
 * wide as the track instead (w-full! beats the inline width) and moved by transform, so a change
 * travels on the compositor and the range's rounded end stays round (scaleX would squash it);
 * the track clips it. Right-to-left it moves the other way.
 *
 * Indeterminate (no value): a band a quarter of the track wide sweeps along it. It is drawn on the
 * track's ::before (Zag puts data-state on the track too), not on the range, so the range's transform
 * never changes kind: while indeterminate the range waits out of sight at translateX(-100%) (no
 * --percent), and a known value grows from the start at duration.move instead of a scaleX(-1) band
 * flipping into a translate. The band is a background moved with the shared fndn-shimmer-text loop
 * (background-position 150% → -50%, which at a 25% band runs from fully out at one end to fully out
 * at the other). That loop runs towards the start, so the band is mirrored left-to-right only.
 * It keeps moving under reduced motion: it is the loading signal, like the spinner.
 *
 * Parts are found by data-slot (progress, progress-label, progress-value, progress-track,
 * progress-range); the root slot is `base`. */

export const progress = tv({
  slots: {
    base: "grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-3 gap-y-1.5",
    label: "col-start-1 min-w-0 text-xs font-medium leading-4 text-ink-2 wrap-anywhere [unicode-bidi:plaintext] [&:dir(ltr)]:text-left [&:dir(rtl)]:text-right",
    value: "col-start-2 text-xs leading-4 text-ink-2 tabular-nums whitespace-nowrap [unicode-bidi:plaintext]",
    track: [
      "relative col-span-2 w-full overflow-hidden rounded-pill bg-line",
      /* indeterminate: the band sweeps along the track */
      "before:absolute before:inset-0 before:hidden before:content-[''] data-[state=indeterminate]:before:block",
      "before:bg-[linear-gradient(90deg,transparent,var(--_tone)_30%,var(--_tone)_70%,transparent)] before:bg-size-[25%_100%] before:bg-no-repeat",
      "before:animate-[fndn-shimmer-text_1.4s_linear_infinite] before:[transform:scaleX(-1)] [&:dir(rtl)]:before:[transform:none]",
    ],
    range: [
      "h-full w-full! rounded-pill bg-(--_tone)",
      "[transform:translateX(calc((var(--percent,0)_-_100)_*_1%))] [&:dir(rtl)]:[transform:translateX(calc((100_-_var(--percent,0))_*_1%))]",
      "motion-transform-move motion-colors-base",
    ],
  },
  variants: {
    size: {
      sm: { track: "h-1" },
      md: { track: "h-1.5" },
    },
    tone: {
      orange: { base: "[--_tone:var(--fndn-orange)]" },
      green: { base: "[--_tone:var(--fndn-green)]" },
      red: { base: "[--_tone:var(--fndn-red)]" },
      accent: { base: "[--_tone:var(--fndn-accent)]" },
    },
  },
  defaultVariants: { size: "md", tone: "orange" },
});

export type ProgressRecipeProps = VariantProps<typeof progress>;
```
