Stat
Import
Section titled “Import”import { Stat } from '@delightstack/components';Basic Usage
Section titled “Basic Usage” 0
Total Users
View code
<Stat value={1234} label="Total Users" />Examples
Section titled “Examples”With Change Indicator
Section titled “With Change Indicator”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"/>With Icon
Section titled “With Icon”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"/>Size Variants
Section titled “Size Variants”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" />Horizontal Layout
Section titled “Horizontal Layout” 0.0 %
Uptime
View code
<Stat horizontal value="99.9%" label="Uptime" />Override Trend Direction
Section titled “Override Trend Direction”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"/>Skeleton Loading
Section titled “Skeleton Loading”View code
<Stat skeleton={loading} value={2451} label="Total Users" size="2" />| Prop | Type | Default | Description |
|---|---|---|---|
value | string | number | required | Main statistic to display |
label | string | - | Descriptive label |
icon | Component | - | Leading icon component |
change | number | - | Percentage change from previous period |
change_label | string | - | Description for the change (e.g., “vs last month”) |
trend | 'up' | 'down' | 'neutral' | auto | Override trend direction (auto-detected from change) |
size | '0' | '1' | '2' | '3' | '1' | Component size |
horizontal | boolean | false | Horizontal layout instead of vertical |
animated | boolean | true | Animate numeric values via the Counter component |
skeleton | boolean | false | Show loading skeleton |
id | string | auto | Element ID |
class | string | '' | Additional CSS classes |
Size Reference
Section titled “Size Reference”| Size | Value Font | Label Font | Use Case |
|---|---|---|---|
'0' | 20px | 11px | Dense dashboards |
'1' | 28px | 13px | Cards, summaries |
'2' | 40px | 15px | Hero stats |
'3' | 56px | 17px | Landing pages |
Accessibility
Section titled “Accessibility”- The stat value uses
aria-live="polite"so screen readers announce value changes - Change indicator includes an
aria-labelwith 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-motionfor skeleton shimmer animations