Radial Gauge Meter
A semicircle gauge whose arc and colour follow a value slider through healthy, warning and critical ranges.
AI prompt
Design a semicircle gauge for "CPU load". An SVG arc with round caps shows the value from 0 to 100 as a stroke-dasharray on a path with pathLength 100, track in light grey. Large centred number with a percent sign (tabular numerals) and a status word beneath (Healthy below 60, Warning from 60 to 85, Critical above 85); stroke colour green, amber or red accordingly with sufficient contrast. Tick labels 0 and 100 at the arc ends. Make it accessible with role meter, aria-valuemin 0, aria-valuemax 100, aria-valuenow and an aria-label. A range slider below sets the value for testing. Arc transitions over 400 milliseconds with ease-out; prefers-reduced-motion removes the transition. Plain HTML, CSS and JavaScript with inline SVG.About this pattern
Definition
A gauge shows one value against a range as an arc. Colour bands tell people at a glance whether the value is within a healthy, warning or critical range.
Purpose & UX principles
- Best for a single KPI with known limits: CPU load, budget used, battery, capacity.
- Always show the number as text as well; never rely on arc length or colour alone.
- Choose thresholds by meaning (for example below 60 healthy, 60 to 85 warning, above 85 critical) and label them.
Interaction states
- Healthy (green), warning (amber), critical (red); the value is announced via role meter.
Motion specification
- The arc animates to the new value over 400ms with ease-out; colour changes at the thresholds.
- Reduced motion: the arc jumps to the value.
Responsive behaviour
- The gauge scales with its container; keep the number at least 24px.
- On narrow screens put the status text below the number.
Code
<div class="bx"><div class="gg" id="gg" role="meter" aria-label="CPU load" aria-valuemin="0" aria-valuemax="100" aria-valuenow="42"><svg viewBox="0 0 200 120" aria-hidden="true"><path class="tr" pathLength="100" d="M20 100A80 80 0 0 1 180 100"/><path class="ar" id="ar" pathLength="100" d="M20 100A80 80 0 0 1 180 100"/><text x="14" y="116" class="lb">0</text><text x="186" y="116" class="lb" text-anchor="end">100</text></svg><div class="nm"><b id="nv">42%</b><span id="st">Healthy</span></div></div>
<label class="ctl">Load <input id="vl" type="range" min="0" max="100" value="42"></label></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
.bx{width:min(260px,100%);display:grid;gap:8px}
.gg{position:relative}svg{width:100%;height:auto;display:block}
.tr,.ar{fill:none;stroke-width:14;stroke-linecap:round}.tr{stroke:#e6e6e2}
.ar{stroke:var(--c,#1a8f4a);stroke-dasharray:var(--v,42) 100;transition:stroke-dasharray .4s ease-out,stroke .3s}
.lb{font-size:10px;fill:#6f6f6f}
.nm{position:absolute;left:0;right:0;bottom:16%;text-align:center;display:grid}.nm b{font-size:32px;letter-spacing:-.02em;font-variant-numeric:tabular-nums}.nm span{font-size:12.5px;font-weight:600;color:var(--c,#1a8f4a)}
.ctl{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}input[type=range]{width:100%;accent-color:#171717}
input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.ar{transition:none}}const gg=document.getElementById('gg'),vl=document.getElementById('vl'),nv=document.getElementById('nv'),st=document.getElementById('st');
function up(){const v=+vl.value,s=v<60?['Healthy','#1a8f4a']:v<=85?['Warning','#b86e00']:['Critical','#d92d20'];gg.style.setProperty('--v',v);gg.style.setProperty('--c',s[1]);nv.textContent=v+'%';st.textContent=s[0];gg.setAttribute('aria-valuenow',v);gg.setAttribute('aria-valuetext',v+' percent, '+s[0]);}
vl.addEventListener('input',up);up();One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Radial Gauge Meter — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.bx{width:min(260px,100%);display:grid;gap:8px}
.gg{position:relative}svg{width:100%;height:auto;display:block}
.tr,.ar{fill:none;stroke-width:14;stroke-linecap:round}.tr{stroke:#e6e6e2}
.ar{stroke:var(--c,#1a8f4a);stroke-dasharray:var(--v,42) 100;transition:stroke-dasharray .4s ease-out,stroke .3s}
.lb{font-size:10px;fill:#6f6f6f}
.nm{position:absolute;left:0;right:0;bottom:16%;text-align:center;display:grid}.nm b{font-size:32px;letter-spacing:-.02em;font-variant-numeric:tabular-nums}.nm span{font-size:12.5px;font-weight:600;color:var(--c,#1a8f4a)}
.ctl{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}input[type=range]{width:100%;accent-color:#171717}
input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.ar{transition:none}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="gg" id="gg" role="meter" aria-label="CPU load" aria-valuemin="0" aria-valuemax="100" aria-valuenow="42"><svg viewBox="0 0 200 120" aria-hidden="true"><path class="tr" pathLength="100" d="M20 100A80 80 0 0 1 180 100"/><path class="ar" id="ar" pathLength="100" d="M20 100A80 80 0 0 1 180 100"/><text x="14" y="116" class="lb">0</text><text x="186" y="116" class="lb" text-anchor="end">100</text></svg><div class="nm"><b id="nv">42%</b><span id="st">Healthy</span></div></div>
<label class="ctl">Load <input id="vl" type="range" min="0" max="100" value="42"></label></div>
</div>
<script>
const gg=document.getElementById('gg'),vl=document.getElementById('vl'),nv=document.getElementById('nv'),st=document.getElementById('st');
function up(){const v=+vl.value,s=v<60?['Healthy','#1a8f4a']:v<=85?['Warning','#b86e00']:['Critical','#d92d20'];gg.style.setProperty('--v',v);gg.style.setProperty('--c',s[1]);nv.textContent=v+'%';st.textContent=s[0];gg.setAttribute('aria-valuenow',v);gg.setAttribute('aria-valuetext',v+' percent, '+s[0]);}
vl.addEventListener('input',up);up();
</script>
</body></html>