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/uinpm install @brand-studio/uiyarn add @brand-studio/uibun add @brand-studio/uiInstall the peer dependencies
npm install react react-domImport the stylesheet once
import '@brand-studio/ui/styles.css';Wrap your app in a brand theme
import { BrandTheme, StatCard } from '@brand-studio/ui'; import brand from './brand.json'; <BrandTheme palette={brand.tokens} mode="system"> {/* your app */} </BrandTheme>
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
valueandnote.
API Reference
| Prop | Type | Default |
|---|---|---|
label | string | – |
value | React.ReactNode | – |
change? | string | – |
trend? | "down" | "flat" | "up" | 'flat' |
note? | React.ReactNode | – |
series? | number[] | – |
className? | string | '' |