Skip to content

Stat

import { Stat } from '@delightstack/components';
0
Total users
View code
<Stat value={1234} label="Total users" />

Positive changes show a green up-arrow, negative changes show a red down-arrow.

$ 0
Revenue
+12.5% vs last month
View code
<Stat
value="$12,450"
label="Revenue"
change={12.5}
change_label="vs last month"
/>

Pass any Svelte component as the icon prop.

<script>
import { Stat } from '@delightstack/components';
import UsersIcon from '~icons/mdi/account-group';
</script>
<Stat
value={1234}
label="Total users"
icon={UsersIcon}
change={15}
change_label="this week"
/>

Four sizes are available for different contexts.

0
Tasks
0
Tasks
0
Tasks
0
Tasks
View code
<Stat value={42} label="Tasks" size="0" />
<Stat value={42} label="Tasks" size="1" />
<Stat value={42} label="Tasks" size="2" />
<Stat value={42} label="Tasks" size="3" />
0.0 %
Uptime
View code
<Stat horizontal value="99.9%" label="Uptime" />

For metrics where a drop is good news (bugs, churn, latency), set positive="down". The arrow still follows the number — down — but it’s colored as an improvement.

0
Open bugs
-15% fewer than last week
View code
<Stat
value={23}
label="Open bugs"
change={-15}
positive="down"
change_label="fewer than last week"
/>
View code
<Stat skeleton={loading} value={2451} label="Total users" size="2" />
PropTypeDefaultDescription
valuestring | numberrequiredMain statistic to display
labelstring-Descriptive label
iconComponent-Leading icon component
changenumber-Percentage change from previous period
change_labelstring-Description for the change (e.g., “vs last month”)
trend'up' | 'down' | 'neutral'autoOverride the arrow direction (auto-detected from change)
positive'up' | 'down''up'Which direction is good news — sets the green/red coloring
size'0' | '1' | '2' | '3''1'Component size
horizontalbooleanfalseHorizontal layout instead of vertical
animatedbooleantrueAnimate numeric values via the Counter component
skeletonbooleanfalseShow loading skeleton
idstringautoElement ID
classstring''Additional CSS classes
SizeValue FontLabel FontUse Case
'0'20px11pxDense dashboards
'1'28px13pxCards, summaries
'2'40px15pxHero stats
'3'56px17pxLanding pages
  • The stat value uses aria-live="polite" so screen readers announce value changes
  • Change indicator includes an aria-label with direction and value (e.g., “increased by 12.5 percent, vs last month”)
  • Trend direction is communicated via text, not just color
  • The arrow icon is aria-hidden="true" since the text conveys the information
  • Respects prefers-reduced-motion for skeleton shimmer animations