ProgressRing
import { ProgressRing } from "@study/ui"
Result
Loading...
Live Editor
function Example() { const [v, setV] = useState(0.62); return ( <div style={{ display: "flex", gap: 20, alignItems: "center" }}> <ProgressRing value={v} label={`${Math.round(v * 100)} percent done`} size={104} thickness={12} tone="petrol"> <span style={{ fontSize: 24 }}>{Math.round(v * 100)} %</span> </ProgressRing> <input type="range" min="0" max="1" step="0.01" value={v} onChange={(e) => setV(+e.target.value)} aria-label="Value" /> </div> ); }
Variants and states
Light
85Dark
85When to use
- Progress of a course, a study session, an upload of known size.
- On course colours with
onTint– then the track is white. animateKey: the ring runs up the first time it appears in a visit, afterwards it stands still.- Unknown duration? Then Spinner.
Props
| Prop | Type | Default | Meaning |
|---|---|---|---|
label * | string | – | Said to screen readers, e.g. "8 of 13 chapters". |
value * | number | – | How far, from 0 to 1. |
animateKey | string | – | Runs up from zero the first time a ring with this key appears in a visit. |
children | ReactNode | – | Inside the ring, e.g. the percentage. |
className | string | – | |
onTint | boolean | – | On a tinted card the track is white; elsewhere it is the sunken grey. |
size | number | 48 | Width and height in px. |
thickness | number | 6 | |
tone | "blau" | "petrol" | "gruen" | "gelb" | "orange" | "rot" | "violett" | "grau" | blau |
Accessibility
- An image with
labelas its description – say the number in words there ("8 of 13 chapters"). - The colour
strongis light; so the number is always also there as text next to it or inside.