Skip to content
Nizivo UI

ProgressRing

A circular progress indicator in three sizes, exposed as a progressbar or, for a measurement, as a meter.

Server component, no client JS

Import

import { ProgressRing } from '@nizivo/react/progress-ring';

// Once per app (Getting started), after
// @nizivo/tokens/tokens.css and @nizivo/react/css/base.css
import '@nizivo/react/css/progress-ring.css';

Static or interactive

Server. It ships no client JavaScript when a Server Component renders it, in every Next.js build mode; its code is bundled only when a client component (a 'use client' file) imports it. How to choose.

In a client app (a Vite or React Router single-page app, or a 'use client' file) it is an ordinary React component: event handlers, refs and state work as usual. In a client app.

Examples

Basic

import type { JSX } from 'react';
import { ProgressRing } from '@nizivo/react/progress-ring';

export function ProgressRingExample(): JSX.Element {
  return (
    <div>
      <ProgressRing aria-label="Store setup" value={25} />
      <ProgressRing aria-label="Monthly goal" meter value={75} tone="success" size="lg" />
      <ProgressRing aria-label="Products imported" value={3} max={4} valueText="3 of 4" size="sm">
        3/4
      </ProgressRing>
    </div>
  );
}

Props

Server component Renders data-slot="progress-ring" with the class nz-progress-ring. Props: ProgressRingProps. Source: src/progress-ring/progress-ring.tsx.

NameTypeDefaultDescription
childrenReactNodethe percentage

The centre, shown to sighted users only (the ring's children are presentational).

localestring'en-US'

BCP 47 tag for the percentage.

maxnumber100

Must be above zero.

meterbooleanfalse

Exposes the ring as a meter (a measurement, such as a goal reached) instead of a progressbar (work under way).

renderRenderProp<ProgressRingState>–

Name the ring with aria-label or aria-labelledby.

sizeProgressRingSize
"sm""md""lg"
'md'
toneProgressRingTone
"brand""success""warning""critical""neutral"
'brand'
valuerequirednumber–

Figma "Value" (25 / 50 / 75 / 100 there). Clamped to 0…max.

valueTextstring–

What assistive technology reads instead of the percentage. Set it whenever children shows something else.

  • Also takes every attribute of <div> except role; children is redeclared above. (Omit<ComponentPropsWithRef<"div">, "role">)

render takes an element, or, in client code, a function of the props and this state (ProgressRingState):

NameTypeDefaultDescription
maxrequirednumber–
sizerequiredProgressRingSize
"sm""md""lg"
–
tonerequiredProgressRingTone
"brand""success""warning""critical""neutral"
–
valuerequirednumber–

The value clamped to 0…max.

Other exports

ProgressRingProps type

import type { ProgressRingProps } from '@nizivo/react/progress-ring'

The props of ProgressRing, listed above.

ProgressRingSize type

import type { ProgressRingSize } from '@nizivo/react/progress-ring'

48 / 72 / 96 px; Figma draws only 72.

type ProgressRingSize = "sm" | "md" | "lg"

ProgressRingState type

import type { ProgressRingState } from '@nizivo/react/progress-ring'

The render state of ProgressRing, listed above.

ProgressRingTone type

import type { ProgressRingTone } from '@nizivo/react/progress-ring'

type ProgressRingTone = "brand" | "success" | "warning" | "critical" | "neutral"

Data attributes and slots

Style parts by class (.nz-<slot>) and state by data attribute. Attribute meanings come from contracts/vocabulary.json.

SlotRendered byData attributes
progress-ring
.nz-progress-ring
ProgressRing
root (takes render)
  • data-size: "sm""md""lg" ← size
    The size prop; values in each component manifest
  • data-tone: "brand""success""warning""critical""neutral" ← tone
    The tone prop; values in each component manifest
progress-ring-fill
.nz-progress-ring-fill
ProgressRing
inner element (CSS only)
none
progress-ring-label
.nz-progress-ring-label
ProgressRing
inner element (CSS only)
none
progress-ring-track
.nz-progress-ring-track
ProgressRing
inner element (CSS only)
none

CSS hooks

Set a hook on the component's class or any ancestor to restyle it without specificity games; leave it unset for the default shown.

HookDefaultRead as
--nz-progress-ring-fill
  • default: var(--nz-chart-primary)
  • data-tone="critical": var(--nz-chart-critical)
  • data-tone="neutral": var(--nz-chart-neutral)
  • data-tone="success": var(--nz-chart-success)
  • data-tone="warning": var(--nz-chart-warning)
  • stroke on .nz-progress-ring-fill
--nz-progress-ring-label-font--nz-font-label-m-strong
  • font on .nz-progress-ring-label
--nz-progress-ring-size
  • default: 4.5rem
  • data-size="lg": 6rem
  • data-size="sm": 3rem
  • block-size on .nz-progress-ring
  • inline-size on .nz-progress-ring
--nz-progress-ring-track-bg--nz-chart-track
  • stroke on .nz-progress-ring-track

Layers: nz.components. Classes: .nz-progress-ring, .nz-progress-ring-fill, .nz-progress-ring-label, .nz-progress-ring-svg, .nz-progress-ring-track.

Tokens this stylesheet reads (10)

--nz-chart-critical, --nz-chart-neutral, --nz-chart-primary, --nz-chart-success, --nz-chart-track, --nz-chart-warning, --nz-duration-base, --nz-easing-standard, --nz-font-label-m-strong, --nz-text-primary

Accessibility

Nothing in this component takes focus or keyboard input.

Keyboard

None.

Figma

Node ids from design/component-map.json, which nz gen writes from component.json. The links open the Nizivo Figma library, which may ask you to sign in.

On this page