Staaarter

Percentage Ring Stats

Grid of circular ring visuals built from SVG circle elements, each filled to the given percent value with the number rendered in the center and a label beneath it. Good for benchmark, target, or completion-rate summaries.

By Staaarter Team
Stats
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/percentage-ring-stats.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/stats/stats10.tsx instead.

Usage

The file also exports stats10Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Stats10, stats10Demo } from "@/components/blocks/stats/stats10";

export default function Page() {
  return <Stats10 {...stats10Demo} />;
}

Props

PropTypeDefaultDescription
badge{ label: string; variant?: BadgeVariant }nonePill above the heading; only rendered when badge is truthy.
headingstringundefinedSection heading.
descriptionstringundefinedSection intro text.
ringsRingStat[]noneRing items rendered in a 2/4-column grid, each with its own percent value.
classNamestringnoneExtra classes for the outer section element.

Types

type RingStat = { label: string; percent: number };

Behavior notes

  • Each ring's fill is computed once from the percent prop at render time using stroke-dasharray/stroke-dashoffset arithmetic; it does not animate and there is no client-side chart library involved.
  • percent is clamped to the 0-100 range before it drives the ring's stroke-dashoffset, so an out-of-range value cannot overflow the circle.
  • The percentage number is rendered as real SVG <text> in the center of each ring, so the value is present as visible text, not conveyed only by the ring's fill.