Bootstrap 5 Statistic Cards Dashboard
A dashboard grid of statistic cards with icon tiles, trend badges, mini sparklines and animated counters, led by a highlighted revenue card.
<section class="wdw-stage">
<div class="container" style="max-width:1120px">
<div class="d-flex flex-wrap align-items-end justify-content-between gap-3 mb-4">
<div>
<span class="wdw-eyebrow">Overview</span>
<h1 class="wdw-heading h2 mt-1 mb-0">Statistical cards</h1>
</div>
<p class="wdw-muted mb-0 small">Last 30 days compared to the previous period</p>
</div>
<div class="row g-3 g-lg-4">
<div class="col-sm-6 col-lg-3">
<article class="wdw-aurora border-0 rounded-4 shadow sc-card h-100 p-4 position-relative overflow-hidden sc-feature">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="sc-icon sc-icon-light" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="18" height="12" rx="2.5"/><circle cx="12" cy="12" r="2.5"/><path d="M7 12h.01M17 12h.01"/></svg></span>
<span class="badge rounded-pill sc-trend sc-up">▲ 12.5%</span>
</div>
<p class="sc-label mb-1">Total revenue</p>
<p class="sc-value mb-3" data-count="128430" data-dec="0" data-pre="$" data-suf="">$128,430</p>
<svg class="sc-spark" data-spark="8,10,9,13,12,16,15,19" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
<div class="col-sm-6 col-lg-3">
<article class="wdw-card-sm sc-card h-100 p-4 position-relative overflow-hidden">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="wdw-icon" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M16 19v-1.5a3.5 3.5 0 0 0-3.5-3.5h-5A3.5 3.5 0 0 0 4 17.5V19"/><circle cx="10" cy="8" r="3.5"/><path d="M20 19v-1.5a3.5 3.5 0 0 0-2.5-3.3M15.5 4.7a3.5 3.5 0 0 1 0 6.6"/></svg></span>
<span class="badge rounded-pill sc-trend sc-up">▲ 8.2%</span>
</div>
<p class="sc-label mb-1">Active users</p>
<p class="sc-value mb-3" data-count="24918" data-dec="0" data-pre="" data-suf="">24,918</p>
<svg class="sc-spark" data-spark="6,8,7,9,11,10,13,14" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
<div class="col-sm-6 col-lg-3">
<article class="wdw-card-sm sc-card h-100 p-4 position-relative overflow-hidden">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="wdw-icon" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 6h15l-1.5 9h-12z"/><path d="M6 6L5 3H2"/><circle cx="9" cy="20" r="1"/><circle cx="18" cy="20" r="1"/></svg></span>
<span class="badge rounded-pill sc-trend sc-down">▼ 3.1%</span>
</div>
<p class="sc-label mb-1">Orders</p>
<p class="sc-value mb-3" data-count="1284" data-dec="0" data-pre="" data-suf="">1,284</p>
<svg class="sc-spark" data-spark="12,11,13,10,11,9,10,8" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
<div class="col-sm-6 col-lg-3">
<article class="wdw-card-sm sc-card h-100 p-4 position-relative overflow-hidden">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="wdw-icon" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg></span>
<span class="badge rounded-pill sc-trend sc-up">▲ 21.4%</span>
</div>
<p class="sc-label mb-1">Page views</p>
<p class="sc-value mb-3" data-count="582" data-dec="0" data-pre="" data-suf="k">582k</p>
<svg class="sc-spark" data-spark="5,7,6,10,9,13,15,18" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
<div class="col-sm-6 col-lg-3">
<article class="wdw-card-sm sc-card h-100 p-4 position-relative overflow-hidden">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="wdw-icon" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2L4 14h7l-1 8 9-12h-7z"/></svg></span>
<span class="badge rounded-pill sc-trend sc-up">▲ -0.4 s</span>
</div>
<p class="sc-label mb-1">Avg. response</p>
<p class="sc-value mb-3" data-count="1.8" data-dec="1" data-pre="" data-suf="s">1.8 s</p>
<svg class="sc-spark" data-spark="14,12,13,10,9,9,7,6" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
<div class="col-sm-6 col-lg-3">
<article class="wdw-card-sm sc-card h-100 p-4 position-relative overflow-hidden">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="wdw-icon" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9a2 2 0 0 0 0 6v3h18v-3a2 2 0 0 1 0-6V6H3z"/><path d="M13 6v12" stroke-dasharray="2 2"/></svg></span>
<span class="badge rounded-pill sc-trend sc-down">▼ 5</span>
</div>
<p class="sc-label mb-1">Open tickets</p>
<p class="sc-value mb-3" data-count="42" data-dec="0" data-pre="" data-suf="">42</p>
<svg class="sc-spark" data-spark="6,7,6,8,9,8,10,11" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
<div class="col-sm-6 col-lg-3">
<article class="wdw-card-sm sc-card h-100 p-4 position-relative overflow-hidden">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="wdw-icon" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></span>
<span class="badge rounded-pill sc-trend sc-up">▲ 0.2</span>
</div>
<p class="sc-label mb-1">Avg. rating</p>
<p class="sc-value mb-3" data-count="4.8" data-dec="1" data-pre="" data-suf="">4.8</p>
<svg class="sc-spark" data-spark="9,10,10,11,11,12,12,13" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
<div class="col-sm-6 col-lg-3">
<article class="wdw-card-sm sc-card h-100 p-4 position-relative overflow-hidden">
<div class="d-flex align-items-start justify-content-between mb-3">
<span class="wdw-icon" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg></span>
<span class="badge rounded-pill sc-trend sc-flat">stable</span>
</div>
<p class="sc-label mb-1">Uptime</p>
<p class="sc-value mb-3" data-count="99.98" data-dec="2" data-pre="" data-suf="%">99.98%</p>
<svg class="sc-spark" data-spark="10,10,10,10,10,10,10,10" viewBox="0 0 100 28" preserveAspectRatio="none" aria-hidden="true"></svg>
</article>
</div>
</div>
</div>
</section>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.sc-card { transition: transform .25s ease, box-shadow .25s ease; }
.sc-card:hover { transform: translateY(-4px); box-shadow: var(--wdw-shadow); }
.sc-label { font-size: .85rem; font-weight: 600; color: var(--bs-secondary-color); }
.sc-value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--bs-emphasis-color); font-variant-numeric: tabular-nums; }
.sc-feature .sc-label { color: rgba(255,255,255,.75); }
.sc-feature .sc-value { color: #fff; }
.sc-icon { width: 2.75rem; height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: rgba(255,255,255,.16); color: #fff; }
.sc-trend { font-size: .75rem; padding: .4em .7em; }
.sc-up { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.sc-down { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.sc-flat { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.sc-feature .sc-trend { background: rgba(255,255,255,.18); color: #fff; }
.sc-spark { display: block; width: 100%; height: 36px; color: var(--bs-primary); overflow: visible; }
.sc-spark path.line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sc-spark path.area { fill: currentColor; opacity: .12; }
.sc-feature .sc-spark { color: #fff; }
@media (prefers-reduced-motion: reduce) { .sc-card { transition: none; } }
(function () {
function initSparklines() {
document.querySelectorAll('.sc-spark').forEach(function (svg) {
var pts = svg.dataset.spark.split(',').map(Number);
var max = Math.max.apply(null, pts), min = Math.min.apply(null, pts);
var span = max - min || 1;
var step = 100 / (pts.length - 1);
var d = pts.map(function (v, i) {
var y = max === min ? 14 : 26 - ((v - min) / span) * 24;
return (i ? 'L' : 'M') + (i * step).toFixed(1) + ' ' + y.toFixed(1);
}).join(' ');
svg.innerHTML = '<path class="area" d="' + d + ' L100 28 L0 28Z"/><path class="line" d="' + d + '"/>';
});
}
function initCounters() {
var els = document.querySelectorAll('[data-count]');
if (!els.length || !('IntersectionObserver' in window) || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (en) {
if (!en.isIntersecting) return;
io.unobserve(en.target);
run(en.target);
});
}, { threshold: 0.4 });
els.forEach(function (el) { io.observe(el); });
function run(el) {
var end = parseFloat(el.dataset.count), dec = +el.dataset.dec;
var final = el.textContent, t0 = null;
function tick(t) {
t0 = t0 || t;
var p = Math.min((t - t0) / 900, 1), e = 1 - Math.pow(1 - p, 3);
if (p >= 1) { el.textContent = final; return; }
var n = end * e;
var s = dec ? n.toFixed(dec) : Math.round(n).toLocaleString('en-US');
el.textContent = el.dataset.pre + s + (el.dataset.suf === 'k' ? 'k' : el.dataset.suf === 's' ? ' s' : el.dataset.suf);
requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
}
}
initSparklines();
initCounters();
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.