# Progress bar API

> Explore the API of Cimpress UI's progress bar component.

Source: https://ui.cimpress.io/components/progress-bar/api/

## Import

```tsx
import { ProgressBar } from '@cimpress-ui/react';
```

## Accessibility notes

`ProgressBar` requires a textual label to remain accessible to assistive technologies. See our [accessibility guide](/dev-guides/accessibility#labelling) for more details.

## Non-percentage values

By default, progress bar operates on percentages, and it expects its `value` prop to be between `0` and `100`. If your data has a different range of allowed values, you don't need to recalculate it manually - provide the upper limit to the `maxValue` prop instead, and the progress bar will handle the calculation for you. Note that the progress bar will still display the value as a percentage, unless you override it through the `valueLabel` prop.

```tsx
import { ProgressBar } from '@cimpress-ui/react';

export default function Demo() {
  return <ProgressBar label="Shipments delivered" value={4} maxValue={20} valueLabel="4 of 20" />;
}
```

## API reference

### ProgressBar

Visualizes the progress of an operation.

See [progress bar usage guidelines](https://ui.cimpress.io/components/progress-bar/).

- `ref`: `Ref<HTMLDivElement>`

  The `ref` type for this component.

**Props: `ProgressBarProps`**

- `tone`: `'success' | 'base' | 'warning' | 'critical'`

  The tone of the progress bar.

  Defaults to `'base'`.

- `showValue`: `boolean`

  Whether the value of the progress bar should be displayed above it.

  Defaults to `true`.

- `description`: `string`

  A description for the progress bar.

- `id`: `string`

  The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

- `data-cim-style-root`: `boolean`

  Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.

- `UNSAFE_className`: `string`

  Sets the CSS className for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

- `UNSAFE_style`: `CSSProperties`

  Sets the CSS style for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

- `label`: `string`

  The content to display as the label.

- `aria-label`: `string`

  Defines a string value that labels the current element.

- `aria-labelledby`: `string`

  Identifies the element (or elements) that labels the current element.

- `aria-describedby`: `string`

  Identifies the element (or elements) that describes the object.

- `aria-details`: `string`

  Identifies the element (or elements) that provide a detailed, extended description for the object.

- `value`: `number`

  The current value (controlled).

  Defaults to `0`.

- `maxValue`: `number`

  The largest value allowed for the input.

  Defaults to `100`.

- `valueLabel`: `ReactNode`

  The content to display as the value's label (e.g. 1 of 4).

**Props: `StyleProps`**

- `margin`: `Responsive<Spacing | "auto">`

  The amount of margin applied to all edges of this component.

- `marginX`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the left and right edges of this component. Takes priority over `margin`.

- `marginY`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the top and bottom edges of this component. Takes priority over `margin`.

- `marginTop`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the top edge of this component. Takes priority over `marginY` and `margin`.

- `marginRight`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the right edge of this component. Takes priority over `marginX` and `margin`.

- `marginBottom`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the bottom edge of this component. Takes priority over `marginY` and `margin`.

- `marginLeft`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the left edge of this component. Takes priority over `marginX` and `margin`.
