CwStatCard
Displays statistical summaries (min / avg / max) with a visual range bar, current reading, and current-vs-average delta.
Default (expandable)
Custom accent colour
Non-expandable
Quick Glance
10 30 50
Min Avg Max
CO₂ Summary
4,583ppm 3,963ppm
380 620 1200
Min Avg Max
Current vs average
<script lang="ts">
import { CwStatCard } from '@cropwatchdevelopment/cwui';
import type { CwStatCardData } from '@cropwatchdevelopment/cwui';
const stats: CwStatCardData = {
min: 18.2,
max: 32.7,
avg: 24.5,
median: 24.1,
stdDev: 3.2,
count: 288,
lastReading: 25.3
};
</script>
<CwStatCard title="Temperature" stats={stats} unit="°C" /><CwStatCard
title="Humidity"
stats={humidityStats}
unit="%"
accentColor="var(--cw-info-500)"
/><CwStatCard
title="Light Intensity"
stats={lightStats}
unit="lux"
expandable={false}
/>Localized labels (i18n)
Pass a labels prop to override any or all display strings. Only the provided keys are replaced; the rest stay English by default.
<script lang="ts">
import { CwStatCard } from '@cropwatchdevelopment/cwui';
import type { CwStatCardLabels } from '@cropwatchdevelopment/cwui';
const jaLabels: CwStatCardLabels = {
min: '最小',
avg: '平均',
max: '最大',
count: '件数',
median: '中央値',
stdDev: '標準偏差',
range: '範囲',
aboveAvg: '平均以上',
belowAvg: '平均以下',
atAvg: '平均',
clickToExpand: 'クリックで展開',
clickToCollapse: 'クリックで折りたたむ',
};
</script>
<CwStatCard title="温度" stats={stats} unit="°C" labels={jaLabels} />