Default
import { PixelStatCard } from '@pxlkit/ui-kit';
export function Default() {
return <PixelStatCard label="Revenue" value="$12,480" trend="+8.2% vs last week" />
}Compact metric card surfacing a label, value, optional icon and trend line for dashboards and KPI grids.
import { PixelStatCard } from '@pxlkit/ui-kit';| Prop | Type | Default | Description |
|---|---|---|---|
label (required) | string | — | Caption rendered above the value. |
value (required) | string | — | Primary metric value. |
icon | React.ReactNode | — | Optional leading icon. |
tone | 'green' | 'cyan' | 'gold' | 'red' | 'purple' | 'pink' | 'neutral' | 'gold' | Tone tint for border, soft background, and icon color. |
trend | string | — | Optional trend/delta line rendered under the value. |
surface | 'pixel' | 'linear' | — | Visual surface override. |
size | 'sm' | 'md' | 'lg' | 'md' | Padding + typography scale. Defaults to 'md'. |
iconPosition | 'left' | 'right' | 'top' | 'bottom-left' | 'top' | Icon placement relative to label/value. Defaults to 'top'. |
valueTone | boolean | false | Color the value with the tone color instead of the default text color. |
align | 'start' | 'center' | 'start' | Horizontal alignment of label/value/trend. Defaults to 'start'. |
bordered | boolean | true | Render with surface-aware border + radius chrome. Defaults to true — a stat card needs visible chrome. |
WCAG target: 2.1 AA
nonePresentational card with no interactive affordances; relies on surrounding heading hierarchy and tone contrast tokens for legibility.
import { PixelStatCard } from '@pxlkit/ui-kit';
export function Default() {
return <PixelStatCard label="Revenue" value="$12,480" trend="+8.2% vs last week" />
}import { PixelStatCard } from '@pxlkit/ui-kit';
export function Default() {
return <PixelStatCard label="Revenue" value="$12,480" trend="+8.2% vs last week" />
}import { PixelStatCard } from '@pxlkit/ui-kit';
export function Tones() {
return (
<div className="grid grid-cols-2 gap-3">
<PixelStatCard label="Active" value="1,204" tone="green" trend="+3.1%" />
<PixelStatCard label="Pending" value="48" tone="gold" trend="2 overdue" />
<PixelStatCard label="Cancelled" value="12" tone="red" trend="-1 vs ayer" />
<PixelStatCard label="Sessions" value="3.2k" tone="cyan" trend="+220 hoy" />
<PixelStatCard label="Members" value="89" tone="purple" />
<PixelStatCard label="Likes" value="412" tone="pink" />
<PixelStatCard label="Drafts" value="7" tone="neutral" />
</div>
)
}import { PixelStatCard } from '@pxlkit/ui-kit';
export function Sizes() {
return (
<div className="flex flex-col gap-3">
<PixelStatCard label="Small" value="$1,200" size="sm" trend="+2%" tone="cyan" />
<PixelStatCard label="Medium" value="$8,400" size="md" trend="+5%" tone="gold" />
<PixelStatCard label="Large" value="$24,900" size="lg" trend="+11%" tone="green" />
</div>
)
}import { PixelStatCard } from '@pxlkit/ui-kit';
export function Surfaces() {
return (
<div className="grid grid-cols-2 gap-3">
<PixelStatCard label="Pixel" value="$4,200" surface="pixel" tone="gold" trend="+6%" />
<PixelStatCard label="Linear" value="$4,200" surface="linear" tone="gold" trend="+6%" />
</div>
)
}import { PixelStatCard } from '@pxlkit/ui-kit';
export function IconPositions() {
const dot = <span aria-hidden="true">$</span>
return (
<div className="grid grid-cols-2 gap-3">
<PixelStatCard label="Top" value="$1,200" icon={dot} iconPosition="top" tone="cyan" />
<PixelStatCard label="Left" value="$1,200" icon={dot} iconPosition="left" tone="green" />
<PixelStatCard label="Right" value="$1,200" icon={dot} iconPosition="right" tone="purple" />
<PixelStatCard
label="Bottom-left"
value="$1,200"
icon={dot}
iconPosition="bottom-left"
tone="gold"
/>
</div>
)
}import { PixelStatCard } from '@pxlkit/ui-kit';
export function WithoutTrend() {
return <PixelStatCard label="Total users" value="12,480" tone="cyan" />
}import { PixelStatCard } from '@pxlkit/ui-kit';
export function TonedValueCentered() {
return (
<div className="grid grid-cols-2 gap-3">
<PixelStatCard label="Uptime" value="99.98%" tone="green" valueTone align="center" />
<PixelStatCard label="Error rate" value="0.02%" tone="red" valueTone align="center" />
</div>
)
}