Skip to content

ProgressBox

Shows progress as a row of plates that fill in turn. It is the shape that fits a loading state on a Neba surface.

tsx
import { ProgressBox } from 'neba';

<ProgressBox />
<ProgressBox value={62} label="Migrating" showValue />

Props

PropTypeDefaultDescription
valuenumber | nullnullHow far along, between min and max. null(the default) is indeterminate: an indicator that has not been told a value should say so rather than draw an empty bar
minnumber0The bottom of the range
maxnumber100The top of the range
sizeshared'xs' | 'sm' | 'md' | 'lg' | 'xl''md'The size of one plate
colorshared'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info''primary'Semantic colour role
labelReactNodeA name for what is loading. Read out with the value by a screen reader
showValuebooleanfalseShows the value as text beside the shape. Percentage of the range unless format says otherwise
formatIntl.NumberFormatOptionsHow to write the value. Without it the value is a percentage of min…max, the only formatting that holds for a range nobody described
countnumber4How many plates. Four reads as a wave and can still be counted at a glance. Set it to the number of steps when the thing being waited on genuinely has steps

Native <div> attributes pass through to the root. Only color and children are excluded, since the table above spells them differently.

value, min, max, format and showValue behave as they do on ProgressLinear. A value of null gives the indeterminate state, where the plates light in sequence.

Examples

count

How many plates to draw. With a value, they fill left to right and the leading plate fills partially: all-or-nothing plates could only ever show 0, 25, 50, 75 or 100 at a count of four.

Using it as a step indicator

Match count to the real number of steps and each plate becomes one step, with the running step's plate shown mid-fill.

Reduced motion

The plates never move; only the fill and the light edge animate. Under prefers-reduced-motion the cycle slows down.

Accessibility

  • Carries role="progressbar" with the value attributes, and label becomes the accessible name.
  • The indeterminate state reports itself as indeterminate rather than as zero.

Released under the MIT License