Stat
A single number with a label and a trend.
import
import { Stat } from '@joshicodes/cock';Stats
Eggs this week
142
+12 vs last week
Average weight
63 g
+2 g above average
Lost to foxes
1
+1 this month
Water left
82%
0%
API
Read out of the component sources at build time, so it matches the version you installed.
Every component also takes class, merged
through tailwind-merge so your utility wins.
Props of Stat
| Prop | Type | Default |
|---|---|---|
label required | string | — |
value required | string | number | — |
change e.g. `+12.5%` — coloured by `trend`. | string | — |
trend | 'up' | 'down' | 'flat' | 'flat' |
hint | string | — |
class | string | — |
Snippets of Stat
| Snippet | Type | Default |
|---|---|---|
icon | Snippet | — |