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%
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" />

When a decrease is positive (e.g., bug count going down), override the trend color.

0
Open Bugs
-15%
View code
<Stat
value={23}
label="Open Bugs"
change={-15}
trend="up"
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 trend direction (auto-detected from change)
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