Documentation

Progress

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

Web + MobileBêtaRetours

Web et mobile — le même composant pour React et React Native. Bêta : son API peut encore changer à une version mineure.

Quand l’utiliser

  • 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.

Quand ne pas l’utiliser

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

Installation

Installer

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

Styles

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

Importer

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

Exemples

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).

PropTypeDéfautDescription
labelrequisstring—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).

Accessibilité

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

Bonnes pratiques

  • 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.

Générée depuis le code de @krizaka/ui 2.0.0-beta.6 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page