npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@choice-ui/progress

v0.0.3

Published

A progress indicator component for displaying task completion, loading states, or value ranges

Downloads

238

Readme

Progress

A versatile progress indication component that provides both linear (ProgressBar) and circular (ProgressCircle) variants for visualizing completion ratios and ongoing processes.

Import

import { ProgressBar, ProgressCircle } from "@choice-ui/react"

Features

  • Dual Components: Linear progress bar and circular progress indicator
  • Multiple Variants: Theme-aware color variants (accent, default)
  • Dynamic Color System: Smooth color blending based on progress value
  • Size Options: Multiple size configurations for different contexts
  • State Support: Indeterminate state for unknown duration processes
  • Striped Animation: Moving texture for ongoing processes (ProgressBar only)
  • Value Display: Optional percentage/value text display
  • Compound Pattern: Flexible composition using sub-components
  • Accessibility: Full ARIA support with proper progress indicators

ProgressBar Usage

Basic Progress Bar

<ProgressBar
  value={45}
  showValue
>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

With Label

<ProgressBar
  value={60}
  showValue
>
  <ProgressBar.Label>Processing</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

Sizes

<ProgressBar size="small" value={60} showValue>
  <ProgressBar.Label>Small</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

<ProgressBar size="default" value={60} showValue>
  <ProgressBar.Label>Default</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

<ProgressBar size="large" value={60} showValue>
  <ProgressBar.Label>Large</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

Variants

<ProgressBar variant="accent" value={72} showValue>
  <ProgressBar.Label>Accent Theme</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

<ProgressBar variant="default" value={72} showValue>
  <ProgressBar.Label>Default Theme</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

Striped and Indeterminate

{
  /* Striped progress */
}
;<ProgressBar
  value={65}
  striped
>
  <ProgressBar.Label>Transferring</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

{
  /* Indeterminate state */
}
;<ProgressBar indeterminate>
  <ProgressBar.Label>Loading</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

Dynamic Color Based on Value

{
  /* Evenly spaced colors */
}
;<ProgressBar
  value={value}
  variant="based-on-value"
  dynamicColors={["#ef4444", "#f59e0b", "#22c55e"]}
>
  <ProgressBar.Label showValue>Score</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

{
  /* Custom color stops */
}
;<ProgressBar
  value={value}
  variant="based-on-value"
  dynamicColors={[
    { at: 0, color: "#ef4444" },
    { at: 0.5, color: "#f59e0b" },
    { at: 1, color: "#22c55e" },
  ]}
>
  <ProgressBar.Label showValue>Health</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

ProgressCircle Usage

Basic Circular Progress

<ProgressCircle value={72}>
  <ProgressCircle.Value />
</ProgressCircle>

Different Sizes

<ProgressCircle size={48} strokeWidth={4} value={64}>
  <ProgressCircle.Value />
</ProgressCircle>

<ProgressCircle size={64} value={64}>
  <ProgressCircle.Value />
</ProgressCircle>

<ProgressCircle size={96} strokeWidth={8} value={64}>
  <ProgressCircle.Value />
</ProgressCircle>

Variants

<ProgressCircle variant="accent" value={70}>
  <ProgressCircle.Value />
</ProgressCircle>

<ProgressCircle variant="default" value={70}>
  <ProgressCircle.Value />
</ProgressCircle>

Dynamic Colors

<ProgressCircle
  value={value}
  variant="based-on-value"
  dynamicColors={["#ef4444", "#f59e0b", "#22c55e"]}
>
  <ProgressCircle.Value />
</ProgressCircle>

ProgressBar Props

interface ProgressBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "role"> {
  /** Array of colors or color stops for dynamic color blending */
  dynamicColors?: Array<string | { at?: number; color: string }>

  /** Whether the progress is in indeterminate state */
  indeterminate?: boolean

  /** Maximum progress value */
  max?: number

  /** Minimum progress value */
  min?: number

  /** Whether to show the progress value as text */
  showValue?: boolean

  /** Progress bar size variant */
  size?: "small" | "large" | "default"

  /** Whether to show striped animation */
  striped?: boolean

  /** Current progress value */
  value?: number

  /** Visual style variant */
  variant?: "accent" | "default" | "based-on-value"
}

ProgressCircle Props

interface ProgressCircleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "role"> {
  /** Array of colors or color stops for dynamic color blending */
  dynamicColors?: Array<string | { at?: number; color: string }>

  /** Maximum progress value */
  max?: number

  /** Minimum progress value */
  min?: number

  /** Circle diameter in pixels */
  size?: number

  /** Stroke width in pixels (defaults to size / 16) */
  strokeWidth?: number

  /** Current progress value */
  value?: number

  /** Visual style variant */
  variant?: "accent" | "default" | "based-on-value"
}
  • Defaults:
    • ProgressBar: size: "default", variant: "accent", value: 0, min: 0, max: 100
    • ProgressCircle: size: 64, strokeWidth: size / 16, variant: "accent", value: 0, min: 0, max: 100

Sub-components

ProgressBar Sub-components

  • ProgressBar.Label: Displays label text with optional value display
  • ProgressBar.Track: Container for the progress indicator
  • ProgressBar.Connects: The filled portion of the progress bar

ProgressCircle Sub-components

  • ProgressCircle.Value: Displays the percentage value inside the circle

Styling

  • Both components use Tailwind CSS via tailwind-variants in tv.ts
  • Customize using the className prop; classes are merged with internal classes
  • ProgressBar slots: root, label, labelWrapper, value, track, connects
  • ProgressCircle slots: root, svg, track, fill, value

Best practices

  • Use ProgressBar for linear processes and file uploads
  • Use ProgressCircle for compact spaces and dashboard widgets
  • Choose indeterminate when duration is unknown
  • Use striped for ongoing processes that need visual activity
  • Select appropriate sizes based on visual hierarchy and available space
  • Use dynamic colors to convey semantic meaning (red=low, green=high)
  • Provide meaningful labels for screen readers

Usage Guidelines

When to Use ProgressBar

  • File uploads and downloads
  • Form completion progress
  • Multi-step processes
  • When horizontal space is available

When to Use ProgressCircle

  • Dashboard widgets and cards
  • Compact progress indicators
  • Circular layouts and designs
  • When space is constrained

Dynamic Color System

  • Use evenly spaced colors for simple gradients
  • Use custom stops with at values for precise control
  • Colors are smoothly interpolated using tinycolor2
  • Supports both hex colors and named colors

Accessibility

  • Both components expose proper ARIA attributes: role="progressbar", aria-valuemin/max/now
  • indeterminate state omits value attributes as progress is unknown
  • Value text is announced to screen readers
  • Support for custom aria-label attributes

Examples

File Upload Progress

<ProgressBar
  value={uploadProgress}
  showValue
  striped={isUploading}
>
  <ProgressBar.Label>Uploading files...</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

Health Score Indicator

<ProgressCircle
  value={healthScore}
  variant="based-on-value"
  dynamicColors={[
    { at: 0, color: "#dc2626" }, // Red for low
    { at: 0.5, color: "#f59e0b" }, // Orange for medium
    { at: 1, color: "#16a34a" }, // Green for high
  ]}
>
  <ProgressCircle.Value />
</ProgressCircle>

Loading State

<ProgressBar indeterminate>
  <ProgressBar.Label>Processing your request...</ProgressBar.Label>
  <ProgressBar.Track>
    <ProgressBar.Connects />
  </ProgressBar.Track>
</ProgressBar>

Notes

  • The based-on-value variant requires dynamicColors to be specified
  • Color interpolation is performed using tinycolor2 for smooth transitions
  • Both components support controlled and uncontrolled usage patterns
  • Progress values are automatically clamped between min and max
  • The striped effect is only available on ProgressBar