Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Overlays

  • Dialog
  • Modal
  • AlertDialog
  • Drawer
  • Popover
  • Tooltip
  • HoverCard
  • Glimpse
  • HeroVideoDialog
  • ElementSelectionOverlay

Messages

  • Alert
  • InterceptCard
  • Callout
  • Banner
  • Toast
  • Notification
  • ServiceMessage
  • Result
  • GiftFeed
  • FloatingReactions
  • Popconfirm

Loading and Progress

  • Spin
  • Spinner
  • Progress

Guidance

  • Tour

Progress

progress

Displays determinate or indeterminate progress in linear or circular form.

Usage

Basic usage

Pass in value (default max=100) to fill the progress bar according to the percentage.

tsx
<Progress value={40} className="w-64" />

Show percentage

showValue Displays a percentage label to the right of the progress bar.

60%
tsx
<Progress value={60} showValue className="w-64" />

Hue

tone switches primary / success / warning / danger four semantic colors.

40%
70%
85%
95%
tsx
<>
  <Progress value={40} tone="primary" showValue className="w-64" />
  <Progress value={70} tone="success" showValue className="w-64" />
  <Progress value={85} tone="warning" showValue className="w-64" />
  <Progress value={95} tone="danger" showValue className="w-64" />
</>

Ring Progress

variant="circular" renders the ring, showValue displays the percentage in the center.

75%
tsx
<Progress variant="circular" value={75} showValue />

Indeterminate state

Omit value (undefined) and enter the loading unsteady state, with both linear and circular animations looping.

tsx
<>
  <Progress className="w-64" />
  <Progress variant="circular" />
</>

On a colored card (inverse)

tone="inverse" fills with the foreground color: on a primary card it's a white bar, where a primary fill would blend into the card.

68%
tsx
<Card variant="primary">
  <CardBody>
    <Progress value={68} showValue tone="inverse" />
  </CardBody>
</Card>

When to use

Use Progress for a measurable task with value and max, such as upload, form completion, or quota use, or omit value for indeterminate loading. Use Spin or Spinner when only a busy state is known.

Import

ts
import { Progress, progressPercent, dashOffset } from "@hulianui/ui"

Props

NameTypeDefaultDescription
valuenumber-Current value. Omit or pass undefined for indeterminate mode.
maxnumber100Maximum value.
variant"linear" | "circular""linear"Geometry.
tone"primary" | "danger" | "success" | "warning" | "inverse""primary"Progress tone. inverse fills with the foreground color: on a colored card (Card variant="primary" / data-surface="inverse") it's a white bar, where a primary fill would blend into the card.
sizenumber40Circular diameter in pixels; ignored by linear.
thicknessnumber4Circular stroke width in pixels; ignored by linear.
showValuebooleanfalseShows the percentage at the circular center or linear right edge; ignored when indeterminate.
Inherits HTMLAttributes<HTMLDivElement>. Give the linear variant a width, such as className="w-64".

Example

tsx
<Progress value={60} showValue className="w-64" />
<Progress variant="circular" value={75} showValue />
<Progress className="w-64" />            {/* Indeterminate: value omitted */}

Usage guidelines

  • The circular SVG ring begins at 12 o'clock using the SVG transform="rotate(…)" attribute, not CSS transform. When changing geometry, see [[svg-circular-progress-ring-rotate-via-svg-attr-not-css]]; CSS transform-origin does not behave reliably on SVG geometry elements.
  • showValue has no effect in indeterminate mode because no percentage exists.

Related

Spin · Spinner · Dialog · Modal · AlertDialog · Drawer

Playground

<Progress value={40} />
PreviousSpinnerFeedbackNextTour

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Example
    • Usage guidelines
    • Related
  • Playground