Stat Card

One key number with its change and a sparkline.

Active subscribers

Up +6.1%

1,284

74 more than last month

Skipped deliveries

Down −12%

38

5 fewer than last month

import { StatCard } from '@brand-studio/ui';

export default function StatCardDemo() {
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: 16, width: '100%', maxWidth: 560 }}>
      <StatCard label="Active subscribers" value="1,284" change="+6.1%" trend="up" note="74 more than last month" series={[1120, 1142, 1150, 1181, 1176, 1210, 1244, 1284]} />
      <StatCard label="Skipped deliveries" value="38" change="−12%" trend="down" note="5 fewer than last month" series={[52, 49, 47, 44, 45, 43, 40, 38]} />
    </div>
  );
}

Installation

pnpm add @brand-studio/ui

Usage

import { StatCard } from '@brand-studio/ui';
<StatCard label="Active subscribers" value="1,284" change="+6.1%" trend="up" series={[1120, 1181, 1244, 1284]} />

Accessibility

  • The change is read with its direction in words, such as “Up +6.1%”, not by arrow or colour alone.
  • The sparkline is decorative and hidden from screen readers. Put the numbers that matter in value and note.

API Reference

PropTypeDefault
labelstring
valueReact.ReactNode
change?string
trend?"down" | "flat" | "up"'flat'
note?React.ReactNode
series?number[]
className?string''

Still, Deskhand and Hollis are fictional brands. The coffee photographs are original generated artwork. @brand-studio/ui is MIT licensed.