GitHub

Progress

Displays an indicator showing the completion progress of a task.

CMSPayload CMS Integration

Progress indicators can be used to show upload progress, form completion, or any other measurable progress managed through CMS workflows.

CMS Demo

See how content editors configure progress indicators in a CMS:

Loading...
CMS ConfigurationSimulates Payload CMS progress configuration

Payload Block Example

// In your Payload CMS blocks config
export const ProgressBlock = {
  slug: "progress",
  fields: [
    { name: "label", type: "text", localized: true },
    { name: "value", type: "number", min: 0, max: 100 },
    { name: "showValue", type: "checkbox", defaultValue: true },
  ],
}

Rendering the Progress

import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@mordecai-design-system/ui"

export function ProgressBar({ label, value, showValue }) {
  return (
    <Progress value={value}>
      <ProgressLabel>{label}</ProgressLabel>
      {showValue && <ProgressValue />}
    </Progress>
  )
}

Basic Usage

Loading...
ProgressProgress indicator with label

Installation

pnpm add @corew500/ui

Usage

import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@mordecai-design-system/ui"
<Progress value={33}>
  <ProgressLabel>Loading...</ProgressLabel>
  <ProgressValue />
</Progress>

Examples

Simple Progress

<Progress value={60} />

With Label and Value

<Progress value={75}>
  <ProgressLabel>Uploading</ProgressLabel>
  <ProgressValue />
</Progress>

Indeterminate

<Progress value={null} />

Sub-components

| Component | Description | |-----------|-------------| | Progress | Root container with value | | ProgressTrack | Background track | | ProgressIndicator | Filled indicator | | ProgressLabel | Descriptive label | | ProgressValue | Percentage display |

Props

Progress

PropTypeDefaultDescription
aria-valuetextstringA string value that provides a user-friendly name for `aria-valuenow`, the current value of the meter.
formatNumberFormatOptionsOptions to format the value.
getAriaValueText(formattedValue: string, value: number) => stringAccepts a function which returns a string value that provides a human-readable text alternative for the current value of the progress bar.
localeenumThe locale used by `Intl.NumberFormat` when formatting the value. Defaults to the user's runtime locale.
maxnumber100The maximum value.
minnumber0The minimum value.
value*numbernullThe current value. The component is indeterminate when value is `null`.
styleenumStyle applied to the element, or a function that returns a style object based on the component’s state.
classNameenumCSS class applied to the element, or a function that returns a class based on the component’s state.
renderenumAllows you to replace the component’s HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.

ProgressLabel

Standard label props with styling.

ProgressValue

Auto-displays the current percentage.