Skip to content

Donut Metric

A copy-paste kpi & dashboard widgets component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

KPI & Dashboard WidgetsHTMLCSSany framework
2.4Ktickets
Open 58%
Closed 30%
Pending 12%

Copy into your project

HTML
<div class="nuda-kpi-donut">
  <div class="nuda-kpi-donut__chart-wrap">
    <svg class="nuda-kpi-donut__svg" viewBox="0 0 80 80">
      <circle class="nuda-kpi-donut__bg" cx="40" cy="40" r="30"></circle>
      <circle class="nuda-kpi-donut__seg nuda-kpi-donut__seg--a" cx="40" cy="40" r="30"></circle>
      <circle class="nuda-kpi-donut__seg nuda-kpi-donut__seg--b" cx="40" cy="40" r="30"></circle>
      <circle class="nuda-kpi-donut__seg nuda-kpi-donut__seg--c" cx="40" cy="40" r="30"></circle>
    </svg>
    <div class="nuda-kpi-donut__total">
      <span class="nuda-kpi-donut__total-num">2.4K</span>
      <span class="nuda-kpi-donut__total-lbl">tickets</span>
    </div>
  </div>
  <div class="nuda-kpi-donut__legend">
    <div class="nuda-kpi-donut__legend-item"><span class="nuda-kpi-donut__dot nuda-kpi-donut__dot--a"></span>Open <strong>58%</strong></div>
    <div class="nuda-kpi-donut__legend-item"><span class="nuda-kpi-donut__dot nuda-kpi-donut__dot--b"></span>Closed <strong>30%</strong></div>
    <div class="nuda-kpi-donut__legend-item"><span class="nuda-kpi-donut__dot nuda-kpi-donut__dot--c"></span>Pending <strong>12%</strong></div>
  </div>
</div>
CSS
.nuda-kpi-donut {
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-width: 240px;
}

.nuda-kpi-donut__chart-wrap {
  position: relative;
  flex-shrink: 0;
  width: 82px;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nuda-kpi-donut__svg {
  width: 82px;
  height: 82px;
  transform: rotate(-90deg);
}

.nuda-kpi-donut__bg {
  fill: none;
  stroke: rgba(255,255,255,.07);
  stroke-width: 12;
}

.nuda-kpi-donut__seg {
  fill: none;
  stroke-width: 12;
  stroke-linecap: butt;
}

.nuda-kpi-donut__seg--a {
  stroke: #e4ff54;
  stroke-dasharray: 109.3 188.5;
  stroke-dashoffset: 0;
}

.nuda-kpi-donut__seg--b {
  stroke: #4a9eff;
  stroke-dasharray: 56.6 188.5;
  stroke-dashoffset: -109.3;
}

.nuda-kpi-donut__seg--c {
  stroke: #ff6b6b;
  stroke-dasharray: 22.6 188.5;
  stroke-dashoffset: -165.9;
}

.nuda-kpi-donut__total {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.nuda-kpi-donut__total-num {
  color: #fafafa;
  font-size: 1rem;
  font-weight: 700;
}

.nuda-kpi-donut__total-lbl {
  color: #555;
  font-size: .58rem;
}

.nuda-kpi-donut__legend {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.nuda-kpi-donut__legend-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: #cfcfcf;
  font-size: .72rem;
}

.nuda-kpi-donut__legend-item strong {
  color: #fafafa;
  margin-left: auto;
  padding-left: .6rem;
}

.nuda-kpi-donut__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.nuda-kpi-donut__dot--a {
  background: #e4ff54;
}

.nuda-kpi-donut__dot--b {
  background: #4a9eff;
}

.nuda-kpi-donut__dot--c {
  background: #ff6b6b;
}

How to use Donut Metric

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More kpi & dashboard widgets components

← Browse all NudaUI components