Progress Ring
FreeA circular progress bar that springs to its value.
Installation
pnpm dlx shadcn@latest add @viewport/progress-ring
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above.
"use client";
import { useState } from "react";
import { ProgressRing } from "@/components/viewport/progress-ring";
export default function ProgressRingDemo() {
const [value, setValue] = useState(64);
return (
<div className="flex flex-col items-center gap-6">
<ProgressRing value={value} label="Storage used" size={128} thickness={10} />
<div className="flex gap-2">
{[12, 64, 100].map((v) => (
<button
key={v}
onClick={() => setValue(v)}
className="rounded-md border border-border px-3 py-1 text-xs font-medium outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring"
>
{v}%
</button>
))}
</div>
</div>
);
}Props
| Prop | Type | Default |
|---|---|---|
| value* | numberCurrent value, between 0 and `max`. | — |
| max | number | 100 |
| size | numberDiameter in pixels. | 96 |
| thickness | numberStroke width in pixels. | 8 |
| label* | stringAccessible name, e.g. "Storage used". | — |
| showValue | booleanShow the percentage in the center. | true |
| className | string | — |
Accessibility
- Exposed as role=progressbar with min, max and current values.
- Requires a `label` for its accessible name.
- Jumps to the value under reduced motion.