HextaUI

Progress: Custom range and format

Set min and max for any range, format for the number, and a function child on <ProgressValue /> for the text. Give screen readers the same words with getAriaValueText.

Storage
x
"use client"

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

export function ProgressFormat() {
  return (
    <div className="w-full max-w-sm">
      <Progress
        value={37.5}
        max={50}
        format={{ maximumFractionDigits: 1 }}
        getAriaValueText={(formatted) => `${formatted} of 50 GB used`}
      >
        <ProgressLabel>Storage</ProgressLabel>
        <ProgressValue>{(formatted) => `${formatted} of 50 GB`}</ProgressValue>
      </Progress>
    </div>
  )
}

This adds the example as components/examples/progress/format.tsx, together with the Progress component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/progress-format.json

To add only the component, follow the Progress installation.

Props in this example

The Progress props this example sets, from the API reference.

PropTypeDefault
valuenull makes the bar indeterminate.
number | null–
max
number100
formatFormats the value. Without it, the value shows as a percentage.
Intl.NumberFormatOptions–
getAriaValueText
(formattedValue: string, value: number | null) => string–

Every prop is in the Progress API reference.

See them all, with keyboard support and accessibility notes, on the Progress page.