Documentation

Progress

How far a task or a goal has come: a bar or a ring, determinate or indeterminate.

Web + MobileBetaFeedback

Web and mobile — the same component for React and React Native. Beta: its API may still change in a minor version.

When to use

  • For a task with a known end: an upload, a processing step, a profile to complete.
  • A ring with its amount in the centre for a goal: money raised, steps done.
  • Indeterminate (no value) for a wait of unknown length inside a layout.

When not to use

  • For a short, unknown wait with nothing to show.Use instead: Spinner
  • While the content of a page loads.Use instead: Skeleton
  • For the time left until a moment.Use instead: Countdown

Installation

Install

npm install @krizaka/ui@beta @krizaka/tailwind@beta @krizaka/tokens@beta tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { Progress } from "@krizaka/ui/progress";

Examples

Bar

A task with a known end.

Bar sizes

sm, md, lg.

Indeterminate bar

A wait of unknown length.

Ring

A goal with its amount in the centre.

42%
$750of $1,000

Indeterminate ring

A ring without a value.

Props

A progress bar or ring: value / max, indeterminate without a value. State: data-state (loading · complete · indeterminate).

PropTypeDefaultDescription
labelrequiredstring—The accessible name — passed translated ("Upload", "Raised towards the goal").
childrenReactNode—A ring's centre: an amount, a percentage, an icon.
maxnumber100The value that means complete.
size"sm" | "md" | "lg"mdsm · md · lg: the bar's thickness, the ring's diameter.
valuenumber | null—How far, between 0 and max. null or absent: indeterminate (a wait of unknown length).
valueTextstring—The value in words for assistive technology ("$420 of $1,000") — default: the percentage.
variant"bar" | "ring"barbar · ring (a ring holds its children in the centre).

Accessibility

  • role="progressbar" named by label, with aria-valuenow, aria-valuemax and aria-valuetext.
  • Indeterminate: no value attributes; the motion stops under prefers-reduced-motion.

Best practices

  • Always a label (“Upload”), translated: it names the bar.
  • Give valueText when the percentage is not what matters (“$420 of $1,000”).
  • Do not move the bar backwards: if a task restarts, say so.

Generated from the code of @krizaka/ui 2.0.0-beta.6: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page