Stats, rings


Install
npx shadcn add @klarhimmel/stats-ringsDetailsAbout, usage, props and more
Two to four percentages as rings with the figure in the middle, a label and a note under each.
Import
Import
- stats/rings
- About
- Two to four percentages as rings with the figure in the middle, a label and a note under each. The fill is the number in `value` (0 to 100); a value with no number draws an empty ring. For rates and shares, not raw counts.
- Category
- A few numbers that prove the point. New project? Set it up once: /get-started/installation.
Notes
When to use it
Two to four percentages shown as rings with the figure in the middle and a label and note below. Use stats-bars when you have up to six measures or want them compared in a list.
Writing for it
- The first number in value (20 characters) decides how much of the ring is filled, so '92%' fills most of the circle. Keep it a real percentage. - The label (60 characters) is a heading for the ring, so name the thing counted, such as 'On-time delivery'. - The note (100 characters) is limited to a narrow width under the ring, so use it for the basis in a short clause.
Watch out for
A value with no number, like 'n/a', draws an empty ring, not a missing one. Raw counts such as '1 240' would be read as a percentage and clamp to 100, so do not use rings for them.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Name the topic' | Text, up to 60 characters. |
title | string | 'Say what a period of use looks like' | Text, up to 120 characters. |
description | string | 'Say what the figures average over a…' | Text, up to 300 characters. |
items | { value, label, note }[] | 4 items | List of 2 to 4. Each item: value, label, note. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |