# Progress

Displays an indicator showing the completion progress of a task.

## Installation

```bash
npx shadcn@latest add https://reactdocs.canceydejean.dev/r/progress.json
```

[Registry JSON](https://reactdocs.canceydejean.dev/r/progress.json)

## Preview

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

export function Preview() {
  return (
    <div className="w-full max-w-sm">
      <Progress value={60}>
        <ProgressLabel>Upload</ProgressLabel>
        <ProgressValue />
      </Progress>
    </div>
  );
}
```


## Source

### progress.tsx

```tsx
"use client";

import { Progress as ProgressPrimitive } from "@base-ui/react/progress";

import { cn } from "cn";

function Progress({
  className,
  children,
  value,
  ...props
}: ProgressPrimitive.Root.Props) {
  return (
    <ProgressPrimitive.Root
      value={value}
      data-slot="progress"
      className={cn("flex flex-wrap gap-3", className)}
      {...props}
    >
      {children}
      <ProgressTrack>
        <ProgressIndicator />
      </ProgressTrack>
    </ProgressPrimitive.Root>
  );
}

function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
  return (
    <ProgressPrimitive.Track
      className={cn(
        "bg-muted relative flex h-1 w-full items-center overflow-x-hidden rounded-full",
        className,
      )}
      data-slot="progress-track"
      {...props}
    />
  );
}

function ProgressIndicator({
  className,
  ...props
}: ProgressPrimitive.Indicator.Props) {
  return (
    <ProgressPrimitive.Indicator
      data-slot="progress-indicator"
      className={cn("bg-primary h-full transition-all", className)}
      {...props}
    />
  );
}

function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
  return (
    <ProgressPrimitive.Label
      className={cn("text-sm font-medium", className)}
      data-slot="progress-label"
      {...props}
    />
  );
}

function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
  return (
    <ProgressPrimitive.Value
      className={cn(
        "text-muted-foreground ml-auto text-sm tabular-nums",
        className,
      )}
      data-slot="progress-value"
      {...props}
    />
  );
}

export {
  Progress,
  ProgressTrack,
  ProgressIndicator,
  ProgressLabel,
  ProgressValue,
};
```



## Usage

Use for loading state and task completion. Pair with `ProgressLabel` and `ProgressValue` for
labeled bars. The track and indicator are rendered by default.

```tsx
import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@/components/progress/progress";

export function Example() {
  return (
    <Progress value={60}>
      <ProgressLabel>Upload</ProgressLabel>
      <ProgressValue />
    </Progress>
  );
}
```

Pass `value` as a number from 0–100. Omit or use null for an indeterminate presentation when
supported by Base UI.

