Circular Progress SVG
A single-colour SVG progress ring: it fills up to its value when it appears, follows every new value, and its hue can tell the state.
Updated
This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Data has 28 effects, including 1 free. Explore the category →
3 usage examples



How it works
Two stacked SVG circles inside a square .cprg-circle: the track, and the .cprg-bar arc, whose stroke is one dash as long as the whole circumference (314.16 units for a radius of 50). The script shifts that dash according to the value: at 75%, a quarter stays hidden. Both ends of the arc are rounded.
The value is read from aria-valuenow, between aria-valuemin and aria-valuemax: "18 out of 24" gives 75% with no maths on your side. The percentage in the centre is written in the page language ("75%" in English, "75 %" in French) and copied into aria-valuetext.
The ring stays empty until it is half visible, then fills in 2 s. After that, every value written to aria-valuenow makes it glide, forwards or backwards; the text changes straight away.
The arc colour sits in one variable, --cprg-color. A class on the root is enough to go from orange to green when everything is done, or to red below a threshold: the hue switches at once, with no fade.
Accessibility
- A real progress indicator:
role="progressbar", named byaria-label("Progress", to replace with yours), bounds and value exposed; the SVG drawing is hidden from screen readers. - Reduced motion: the stroke transition is turned off and the arc takes its length directly.
- Colour is not enough: if the hue signals a state (low, full), back it with a word next to it, such as "order now". The percentage stays readable in the centre.
- Keyboard: the ring displays, it is not operated; it never takes focus.
- Centre text: white originally (
--cprg-text). On a light background, change it: it does not adapt by itself.
Browser compatibility
SVG strokes styled in CSS (stroke-dasharray, stroke-dashoffset driven by a variable), IntersectionObserver, MutationObserver, Intl.NumberFormat. In Chromium 149, Firefox 151 and WebKit 26.5: stroke offset from 314.16 (empty) to 78.54 (75%), one copy moved to 20% without touching the other, value 130 clamped to 100%, ring without centre text accepted.
Without JavaScript the ring stays empty and the text written in the HTML ("75%") is shown as is. Without IntersectionObserver, it fills as soon as the page loads.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="fx-0234-root">
<div class="cprg-circle" role="progressbar" aria-label="Progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75">
<svg class="cprg-svg" viewBox="0 0 120 120" aria-hidden="true" focusable="false">
<circle class="cprg-track" cx="60" cy="60" r="50"></circle>
<circle class="cprg-bar" cx="60" cy="60" r="50"></circle>
</svg>
<span class="cprg-value">75%</span>
</div>
</div>
One-time payment, no subscription — the code is yours forever
Customize
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
aria-valuenow (HTML) |
75 | Displayed value; writing it again makes the arc glide. |
aria-valuemin, aria-valuemax (HTML) |
0, 100 | Bounds. A value outside them is clamped to 0% or 100%. |
.cprg-value (HTML) |
present | Percentage in the centre. Remove the element for a bare ring or to put your own text there. |
--cprg-color (CSS) |
#6366f1 | Flat colour of the arc. |
--cprg-track, --cprg-text (CSS) |
indigo at 20%, white | Track colour and centre text colour. |
--cprg-size (CSS) |
120px | Diameter; the text follows, at 20% of the diameter. |
--cprg-stroke (CSS) |
8 | Stroke thickness, unitless: in parts of the drawing, which is 120 wide. 8 gives a stroke one fifteenth of the diameter. |
--cprg-duration (CSS) |
2s | Duration of the fill and of every glide. |
--cprg-bg, --cprg-height (CSS) |
#0a0a0f, 300px | Background and minimum height of the block that centres the ring. |
FAQ
<defs> and no id in the HTML. Pick this one when the hue has to mean something (a state, a brand, an ink), the other for a more decorative look..cprg-value: the script does without it. Put your own element inside .cprg-circle (it is position: relative) and centre it: "21 min", "18 / 24", an icon. aria-valuetext remains a percentage; that is what screen readers announce..fx-0234-root and give it its colour: .fx-0234-root.is-low { --cprg-color: #ef4444 }. The variable must be set on the root or below: on a parent, it is overridden by the original value.