GooseUI

Components

Progress Ring

New

Circular progress on SVG. Shows the percentage or your own content in the center, animates the arc when the value changes, switches color by thresholds and has an indeterminate mode for unknown durations.

Preview

Change the value to see the arc move.

Installation

npx shadcn@latest add @gooseui/progress-ring
pnpm dlx shadcn@latest add @gooseui/progress-ring
yarn dlx shadcn@latest add @gooseui/progress-ring
bunx --bun shadcn@latest add @gooseui/progress-ring

Usage

import { ProgressRing } from "@/components/ui/progress-ring"

export default function Example() {
  return <ProgressRing value={64} size={120} thickness={10} label="Upload progress" />
}

Examples

Size and thickness

size sets the diameter, thickness the stroke. rounded={false} gives flat ends.

<ProgressRing value={25} size={40} thickness={4} />
<ProgressRing value={50} size={64} thickness={6} />
<ProgressRing value={75} size={96} thickness={12} />
<ProgressRing value={90} size={128} thickness={4} rounded={false} />

Color by thresholds

Each threshold applies from its from percentage. Here the ring turns warning at 70% and destructive at 90%.

<ProgressRing
  value={usage}
  thresholds={[
    { from: 0, color: "var(--primary)" },
    { from: 70, color: "var(--chart-4)" },
    { from: 90, color: "var(--destructive)" },
  ]}
/>

Custom content

Children replace the percentage. max lets you pass the value in your own units.

3/5tasks
<ProgressRing value={done} max={5} size={112} thickness={9}>
  <span className="text-2xl">{done}/5</span>
  <span className="text-xs text-muted-foreground">tasks</span>
</ProgressRing>

Indeterminate

When the duration is unknown, the arc spins and aria-valuenow is omitted.

<ProgressRing indeterminate size={48} thickness={5} label="Loading" />

Props

PropTypeDefaultDescription
valuenumber0Current value
maxnumber100Maximum value
sizenumber64Diameter in px
thicknessnumber6Stroke width in px
indeterminatebooleanfalseSpinning arc without a value
thresholds{ from: number; color: string }[]-Colors by percentage, the highest matching from wins
colorstring"var(--primary)"Indicator color when no threshold matches
showValuebooleantrueShow the percentage in the center
animateValuebooleantrueRoll the digits of the percentage when the value changes
formatValue(value: number, max: number) => ReactNode-Custom formatter for the center value
childrenReactNode-Custom center content
labelstring"Progress"Accessible name (aria-label)
roundedbooleantrueRound stroke ends
trackClassNamestring-Classes for the track circle
indicatorClassNamestring-Classes for the indicator circle
classNamestring-Additional CSS classes

Features

  • Accessible: role="progressbar" with aria-valuenow, aria-valuemin and aria-valuemax
  • Smooth: the arc animates with a CSS transition, turned off for reduced motion
  • Theme colors: the track uses muted, the indicator primary, thresholds take any CSS color
  • Server friendly: no client hooks, works in server components