Skip to Content

Progress

Displays how far a task has got, as a bar.

x
import { Progress } from "@dapplelight/signet-ui/components/progress"

export function Demo() {
  return <Progress value={64} aria-label="Storage used" />
}

Installation

npm i @dapplelight/signet-ui

Usage

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

<Progress value={64} aria-label="Storage used" />

Built on Base UI's Progress, so the root takes its props.

Examples

Label and value

Storage used
x
import { Progress, ProgressLabel, ProgressValue } from "@dapplelight/signet-ui/components/progress"

<Progress value={72}>
  <ProgressLabel>Storage used</ProgressLabel>
  <ProgressValue />
</Progress>

Controlled

Uploading invoices
x
import { useState } from "react"
import { Progress, ProgressLabel, ProgressValue } from "@dapplelight/signet-ui/components/progress"
import { Button } from "@dapplelight/signet-ui/components/button"

const [value, setValue] = useState(30)

<Progress value={value}>
  <ProgressLabel>Uploading invoices</ProgressLabel>
  <ProgressValue />
</Progress>
<Button onClick={() => setValue((v) => (v >= 100 ? 0 : v + 25))}>Upload more</Button>

Custom range

Onboarding steps
x
import { Progress, ProgressLabel, ProgressValue } from "@dapplelight/signet-ui/components/progress"

<Progress value={3} min={0} max={5}>
  <ProgressLabel>Onboarding steps</ProgressLabel>
  <ProgressValue>{(_, value) => `${value} of 5`}</ProgressValue>
</Progress>

Indeterminate

Syncing orders
x
import { Progress, ProgressLabel } from "@dapplelight/signet-ui/components/progress"

<Progress value={null} aria-label="Syncing">
  <ProgressLabel>Syncing orders</ProgressLabel>
</Progress>

API Reference

Progress

PropTypeDefaultDescription
valuenumber | nullrequiredCurrent value. null means indeterminate.
minnumber0Lowest value.
maxnumber100Highest value.
formatIntl.NumberFormatOptions-How the value is formatted.
localeIntl.LocalesArgumentbrowserLocale for formatting the value.
getAriaValueText(formatted, value) => string-Accessible value text.
classNamestring-Class on the root.
childrenReactNode-ProgressLabel and ProgressValue, shown above the bar.

ProgressLabel

PropTypeDefaultDescription
classNamestring-Class on the label.

ProgressValue

PropTypeDefaultDescription
children(formatted: string | null, value: number | null) => ReactNode-Custom text for the value. Defaults to the formatted percentage.
classNamestring-Class on the value.

ProgressTrack / ProgressIndicator

PropTypeDefaultDescription
classNamestring-The bar and its fill, already rendered by Progress. Export them to build your own.