Kinetik UI

Stat Card

.md

A key figure that counts up, with a change pill and a sparkline that draws itself in.

v1.0.0Live on web@shopify/react-native-skiareact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add stat-card

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/stat-card.json

Install manually

  1. Install dependencies
    npx expo install @shopify/react-native-skia react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/stat-card.tsx
    View source files

Usage

import { StatCard } from '@/components/kinetik/stat-card';

<StatCard
  label="Visitors"
  value={24180}
  delta={0.124}
  caption="vs last week"
  trend={visitsPerDay}
  onPress={openTraffic}
/>;

delta is a fraction (0.124 for +12.4%). Rises are green and falls red; pass invertDelta for figures where lower is better, such as a bounce rate or a load time.

When to use

  • Dashboards and summaries: the handful of numbers someone checks first.
  • A figure that needs context to mean anything: its change and its recent shape.

When not to use

  • Many figures in a dense table. The count-up and the sparkline are for a few headline numbers.
  • Values without a sensible "previous period". Leave out delta rather than inventing one.

Notes

  • Changing value counts on from the current figure, so live updates read as movement, not jumps.
  • formatValue is applied to every counting frame; make sure it rounds (v.toFixed(1), currency formatters).
  • With reduced motion the figure and the sparkline appear complete.

Props

StatCardProps

PropTypeDefaultDescription
labelrequiredstring—What the figure is, e.g. "Visitors".
valuerequirednumber—
formatValue(value: number) => stringgroupedFormats the figure as it counts. Defaults to grouped whole numbers.
deltanumber—Change against the previous period as a fraction: 0.124 for +12.4%.
invertDeltabooleanfalseLower is better, e.g. for a bounce rate: a fall shows as good news.
captionstring—Under the figure, e.g. "vs last week".
trendreadonly number[]—Recent values, oldest first, drawn as a sparkline along the bottom.
iconReactNode—An icon before the label.
colorstring—Sparkline colour. Defaults to the theme azure.
onPress() => void—Makes the card a button.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
The sparkline is built once per data change and revealed by a clip on the UI thread; the figure re-renders only while it counts.
Measured

Pixel 9 emulator, API 35, release build · interaction median 0.85× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 157 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The figure and the sparkline appear complete.
Screen readers
One summary: label, value, change ('up 12.4%') and caption. A button when onPress is set.
Touch target
The whole card when it is pressable.

Source files

components/kinetik/stat-card.tsx is in the Code tab of the preview above.