Skip to content

StatTile

A compact summary stat, Apple/Samsung-Health style — a bold number + label + a small sparkline hinting at the recent trend, instead of a flat colored box with just a number.

Playground

7.420Ø steps / day

Drag sparkline points below 2 to see the sparkline disappear entirely — there's no meaningful line to draw with fewer than two values.

vue
<script setup>
import { StatTile } from 'yemek'
</script>

<template>
  <StatTile
    label="Ø steps / day"
    :value="7420"
    :trend="[6200, 7100, 6800, 8300, 7420]"
    accent-color="var(--yemek-color-accent)"
  />
</template>

Props

PropTypeDefaultDescription
labelstringStat label.
valuenumberThe stat's current value — no averaging/classification happens in the component, the consumer already computed it.
unitLabelstring''Unit suffix, e.g. "kcal".
trendnumber[][]Recent values, oldest first, for the sparkline. Fewer than 2 points hides the sparkline entirely.
accentColorstringvar(--yemek-color-accent)CSS color value — lets each tile pick whichever color fits its metric (e.g. var(--yemek-nutrient-water)) instead of the kit guessing one.

Behavior notes

  • The sparkline draws in via a stroke-dashoffset animation.
  • No trend/average computation happens in the component — pass already-summarized data.