Feedback

ProgressBar

A progress bar shows either determinate or indeterminate progress of an operation over time.

Completeness: styles-sufficient

The stylesheet is the whole component. There is no keyboard map beyond what the native element already does and nothing sets state at runtime that the CSS keys on, so a CSS-only port reproduces it.

Import

import { ProgressBar, Label } from '@blakeui/react';

Usage

Loading60%
import {Label, ProgressBar} from "@blakeui/react";

export function Basic() {
  return (
    <ProgressBar aria-label="Loading" className="w-64" value={60}>

Anatomy

import { ProgressBar, Label } from '@blakeui/react';

export default () => (
  <ProgressBar value={60}>
    <Label>Loading</Label>
    <ProgressBar.Output />
    <ProgressBar.Track>
      <ProgressBar.Fill />
    </ProgressBar.Track>
  </ProgressBar>
);

Sizes

Small40%
Medium60%
Large80%
import {Label, ProgressBar} from "@blakeui/react";

export function Sizes() {
  return (
    <div className="flex w-64 flex-col gap-6">

Colors

Default50%
Accent50%
Success50%
Warning50%
Danger50%
import {Label, ProgressBar} from "@blakeui/react";

export function Colors() {
  return (
    <div className="flex w-64 flex-col gap-6">

Indeterminate

Use isIndeterminate when progress cannot be determined.

Loading...
import {Label, ProgressBar} from "@blakeui/react";

export function Indeterminate() {
  return (
    <ProgressBar isIndeterminate aria-label="Loading" className="w-64">

Custom Value Scale

Use minValue, maxValue, and formatOptions to customize the value range and display format.

Progress75%
Format
"use client";

import {Label, ListBox, NumberField, ProgressBar, Select, Separator} from "@blakeui/react";
import {useState} from "react";

Without Label

When no visible label is needed, use aria-label for accessibility.

import {ProgressBar} from "@blakeui/react";

export function WithoutLabel() {
  return (
    <ProgressBar aria-label="Loading progress" className="w-64" value={45}>

Styling

Passing Tailwind CSS classes

You can customize individual ProgressBar parts:

import { ProgressBar, Label } from '@blakeui/react';

function CustomProgressBar() {
  return (
    <ProgressBar value={60}>
      <Label>Loading</Label>
      <ProgressBar.Output />
      <ProgressBar.Track className="bg-purple-100 dark:bg-purple-900">
        <ProgressBar.Fill className="bg-purple-500" />
      </ProgressBar.Track>
    </ProgressBar>
  );
}

Customizing the component classes

To customize the ProgressBar component classes, you can use the @layer components directive.
Learn more.

A worked example is in Styling.

blakeUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.

CSS Classes

The ProgressBar component uses these CSS classes (View source styles):

Base & Element Classes

  • .progress-bar - Base container (grid layout)
  • .progress-bar__output - Value text display
  • .progress-bar__track - Track background
  • .progress-bar__fill - Filled portion of the track

Size Classes

  • .progress-bar--sm - Small size variant (thinner track)
  • .progress-bar--md - Medium size variant (default)
  • .progress-bar--lg - Large size variant (thicker track)

Color Classes

  • .progress-bar--default - Default color variant
  • .progress-bar--accent - Accent color variant
  • .progress-bar--success - Success color variant
  • .progress-bar--warning - Warning color variant
  • .progress-bar--danger - Danger color variant

API Reference

ProgressBar Props

Inherits from React Aria ProgressBar.

PropTypeDefaultDescription
valuenumber0The current value
minValuenumber0The minimum value
maxValuenumber100The maximum value
isIndeterminatebooleanfalseWhether progress is indeterminate
size"sm" | "md" | "lg""md"Size of the progress track
color"default" | "accent" | "success" | "warning" | "danger""accent"Color of the fill bar
formatOptionsIntl.NumberFormatOptions{style: 'percent'}Number format for the value display
valueLabelReactNode-Custom value label content
childrenReactNode | (values: ProgressBarRenderProps) => ReactNode-Content or render prop

ProgressBarRenderProps

When using the render prop pattern, these values are provided:

PropTypeDescription
percentagenumberThe percentage of the progress (0-100)
valueTextstringThe formatted value text
isIndeterminatebooleanWhether progress is indeterminate

On this page