Skip to content

KPI Card

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

ChartsHTMLCSSany framework

Copy into your project

HTML
<!-- KPI Card -->
<div class="nuda-kpi" role="img" aria-label="Conversions metric, 87 percent">
  <div class="nuda-kpi__head">
    <span class="nuda-kpi__title">Conversions</span>
    <span class="nuda-kpi__delta">↑ 12%</span>
  </div>
  <div class="nuda-kpi__value">87<i>%</i></div>
  <div class="nuda-kpi__bar"><span></span></div>
</div>
CSS
/* KPI Card
   Compact metric card with title, delta, value, and growing bar.
   Customize: --kpi-target (the bar fill %), --kpi-color, --kpi-bg */

.nuda-kpi {
  --kpi-color: #e4ff54;
  --kpi-bg: rgba(255, 255, 255, 0.03);
  --kpi-target: 87%;
  width: 100%;
  max-width: 200px;
  padding: 12px 14px;
  background: var(--kpi-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nuda-kpi__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nuda-kpi__title {
  font: 600 0.625rem ui-sans-serif, system-ui, sans-serif;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nuda-kpi__delta {
  font: 700 0.625rem ui-sans-serif, system-ui, sans-serif;
  color: var(--kpi-color);
  background: rgba(228, 255, 84, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
}

.nuda-kpi__value {
  font: 700 1.6rem ui-sans-serif, system-ui, sans-serif;
  color: #fafafa;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.nuda-kpi__value i {
  font-size: 0.8rem;
  font-style: normal;
  color: #a1a1aa;
  margin-left: 1px;
}

.nuda-kpi__bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.nuda-kpi__bar span {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--kpi-color), rgba(228, 255, 84, 0.6));
  border-radius: 2px;
  animation: nuda-kpi-fill 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes nuda-kpi-fill {
  to { width: var(--kpi-target); }
}

@media (prefers-reduced-motion: reduce) {
  .nuda-kpi__bar span { width: var(--kpi-target); animation: none; }
}

How to use KPI Card

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 charts components

← Browse all NudaUI components