Sparkline Stat Cards
Metric cards each with an inline sparkline chart, via ApexCharts.
Requires Bootstrap 5, ApexCharts. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><script src="https://cdn.jsdelivr.net/npm/apexcharts@3.49.1/dist/apexcharts.min.js"></script><div class="d-flex gap-2 flex-wrap" style="max-width:440px">
<div class="card border-0 shadow-sm flex-fill"><div class="card-body p-2"><div class="small text-secondary">Users</div><div class="h5 fw-bold mb-0">12.4k</div><div id="sp1"></div></div></div>
<div class="card border-0 shadow-sm flex-fill"><div class="card-body p-2"><div class="small text-secondary">Sales</div><div class="h5 fw-bold mb-0">$8.2k</div><div id="sp2"></div></div></div>
</div>function spark(id,data,color){new ApexCharts(document.getElementById(id),{chart:{type:'line',height:40,sparkline:{enabled:true}},series:[{data:data}],stroke:{width:2,curve:'smooth'},colors:[color]}).render()}
spark('sp1',[10,15,12,18,16,22,20],'#0d6efd');spark('sp2',[20,18,24,19,26,22,30],'#16a34a');Free to use.This component uses Bootstrap 5, ApexCharts (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.