Skip to content

ProgressLinear

Shows progress as a horizontal bar. It is the most widely used of the three progress components.

tsx
import { ProgressLinear } from 'neba';

<ProgressLinear value={64} label="Uploading assets" showValue />
<ProgressLinear />

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'Thickness of the groove. Nothing else on a bar has a size
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
thicknessnumberThe groove's thickness in pixels, when the step's own is not the one you want. size still sets the type scale beside it

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

value defaults to null, the indeterminate state: a short segment travels along the groove. A value of 0 means something different ("nothing has progressed yet"), so keep the two apart.

Examples

size

thickness

size is a step on the library's ladder; thickness is a number of pixels, for the bar a page is actually about. It changes the groove alone — size still sets the type scale of the label beside it.

tsx
<ProgressLinear value={62} thickness={12} />

min · max · format

The percentage shown is a proportion of minmax, not of 100. showValue prints it beside the bar, and format takes Intl.NumberFormat options so you can show the number itself: bytes, files, currency.

Reduced motion

prefers-reduced-motion does not stop the indeterminate animation. The travelling segment is replaced by a colour pulse across the whole groove.

Accessibility

  • Carries role="progressbar" with the value and range attributes; aria-valuenow is dropped while indeterminate.
  • label becomes the accessible name, and aria-valuetext says the same thing as the printed value.

Released under the MIT License