# Progress

A simple progress bar to indicate completion or loading status.

```tsx
import { Progress } from '@fluxui-dev/react';

<Progress value={75} />
```

## Max

Set a custom maximum value with the `max` prop for non-percentage scales.

```tsx
<Progress value={3} max={7} />
```

## Color

Override the default accent color with the `color` prop.

```tsx
<Progress value={75} color="purple" />
```

## Height

Customize the height of the progress bar using the `className` prop.

```tsx
<Progress value={75} className="h-3" />
```

## With label

Wrap the progress bar in a `Field` to add a label and description, and name the bar for screen readers with `aria-label`.

```tsx
import { Field, Progress } from '@fluxui-dev/react';

<Field>
    <Field.Label>Upload progress</Field.Label>
    <Progress value={42} color="blue" aria-label="Upload progress" />
    <Field.Description>Uploading 3 of 7 files...</Field.Description>
</Field>
```

## Display value

Display the current value in the label or inline next to the bar.

```tsx
<Field>
    <Field.Label trailing={<span className="tabular-nums">75%</span>}>
        Storage
    </Field.Label>

    <Progress value={75} aria-label="Storage" />
</Field>

<Field>
    <Field.Label>Storage</Field.Label>

    <div className="flex items-center gap-4 -mt-2">
        <Progress value={75} aria-label="Storage" />
        <span className="text-sm tabular-nums ...">75%</span>
    </div>
</Field>
```

## Controlled

Pass a value from state to update the bar as the work progresses.

```tsx
import { useState } from 'react';
import { Button } from '@fluxui-dev/react';

const [progress, setProgress] = useState(50);

<Button size="sm" onClick={() => setProgress(progress - 10)}>Less</Button>
<Button size="sm" onClick={() => setProgress(progress + 10)}>More</Button>

<Progress value={progress} />
```

## Reference

### Progress

**Prop:**

- `value` - Current progress value (`min` to `max`). Default: `0`.
- `max` - Maximum value. Default: `100`.
- `min` - Minimum value. Default: `0`.
- `color` - Bar fill color (e.g., `blue`, `red`, `green`, `zinc`). Default: accent color.
- `getAriaValueText` - Function returning the text screen readers announce for the current value. Defaults to the percentage, such as `75%`.
- `className` - CSS classes applied to the track, such as `h-3` for a taller bar.

**CSS Variable:**

- `--flux-progress` - The computed progress as a raw number (0–100).
- `--flux-progress-percentage` - The computed progress as a percentage string (e.g., `75%`). Used internally to set the bar width.

**Attribute:**

- `data-flux-progress` - Applied to the root element for styling and identification.
- `data-complete` - Applied to the root element once the value reaches `max`.
