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.jsonPrefer 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
| Prop | Type | Default | Description |
|---|---|---|---|
| badge | { label: string; variant?: BadgeVariant } | none | Pill above the heading; only rendered when badge is truthy. |
| heading | string | undefined | Section heading. |
| description | string | undefined | Section intro text. |
| rings | RingStat[] | none | Ring items rendered in a 2/4-column grid, each with its own percent value. |
| className | string | none | Extra 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.
More Stats Blocks
View all →Simple Four Stat Row
A plain 4-column row of big numbers with labels, no icons or chrome.
Stats With Icons
Bordered stat tiles, each topped with a lucide icon above the number.
Big Hero Stat
One dominant, oversized stat with smaller supporting stats below it.
Stats With Progress Bars
A vertical list of stats, each paired with a horizontal progress bar toward a goal.
Animated Counter Row
A 4-stat row whose numbers count up from 0 on mount.
Dashboard Style Grid
A dense analytics-dashboard grid with trend deltas and inline sparklines.