Score Ring
A circular score meter whose color blends from a start to an end color.
Overview
ScoreRing draws a progress ring for a score and shows the number in the middle. The stroke color is mixed between fromColor and toColor by the score, so 0 is red and 100 is green unless you pass other colors.
It is a role="meter". Use Progress for task completion and ScoreRing for a quality or rating score.
Preview
Customize
Installation
Add the component with the CLI. It copies the files in and installs anything they depend on.
npx vinyaas add score-ringUsage
import { ScoreRing } from "@/components/ui/score-ring";
export function Performance() {
return <ScoreRing value={86} label="Performance score" />;
}Examples
Default
The ring color blends from red at 0 to green at 100, so low scores read as warnings.
Sizes
xs, sm, default, and lg scale the ring, stroke, and score text together.
Custom colors
fromColor is the color at 0 and toColor is the color at max. Use any CSS color, including theme variables.
Custom content and range
max changes the full-ring score. children replaces the number, and showValue={false} hides it.
In practice
An audit card shows four category scores. The ring color alone separates healthy scores from failing ones.
Performance
Accessibility
Best practices
SEO
API
Other attributes for the underlying element are passed through.
| Name | Type | Default | Description |
|---|---|---|---|
value | number | — | Score from 0 to max. Values outside the range are clamped. |
max | number | 100 | Score that fills the whole ring. |
size | "xs" | "sm" | "default" | "lg" | "default" | Ring diameter: 32px, 48px, 64px, or 96px. |
fromColor | string | "var(--color-red-500, #ef4444)" | Ring color at a score of 0. Any CSS color. |
toColor | string | "var(--color-green-500, #22c55e)" | Ring color at the maximum score. Any CSS color. |
showValue | boolean | true | Show the rounded score in the middle of the ring. |
children | ReactNode | — | Replaces the score text in the middle of the ring. |
label | string | — | Accessible name for the meter, such as Performance score. |
Accessibility
The ring is a role="meter" with aria-valuenow, aria-valuemin, and aria-valuemax. The SVG is hidden from assistive technology.
- Pass
labelso the meter has an accessible name. - Do not rely on color alone; keep the number visible or put the score in nearby text.
- The fill animation is disabled for reduced motion.