Layout
KpiCard
A metric card with a title, a value, an optional unit, a trend and an icon.
<script>
import { KpiCard } from "@codeatlasdev/ui";
import { DollarSign } from "@lucide/svelte";
</script>
<KpiCard title="Monthly Revenue" value="$48,200" trend={12.4} icon={DollarSign} />
Put several cards in a KpiGrid so a row never ends on an empty cell.
Basic metrics
Monthly Revenue
$48,200
↑+12.4%Active Users
3,847
↓-2.1%Conversion
4.8 %
↑+0.6%Code
Without trend
Omit trend and the indicator disappears.
Orders Today
124
Avg. Session
3m 42s
Error Rate
0.03 %
Code
Negative trend
Churn Rate
5.2 %
↓-1.8%Response Time
1.4 s
↓-12.3%Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | – | Metric name. |
value | string | number | – | Main value. |
unit | string | – | Unit shown after the value (%, s, users). |
trend | number | – | Percentage change. Positive is green, negative is red, zero is neutral. |
icon | IconComponent | – | Lucide icon. Size and color are managed by the card. |
class | string | '' | Extra class names. |