DS0
Patterns

Dashboard Stats

A responsive grid of metric cards with trend indicators and loading state.

Overview

The DashboardStats recipe renders a responsive grid of metric cards. Each card shows a label, value, and optional trend indicator with percentage change. Includes a loading skeleton state.

Revenue

$45,231

+12.5%from last month
Users

2,350

-3.1%from last month
Orders

1,234

+8.2%from last month
Conversion

3.2%

+0.5%from last month

Usage

import { DashboardStats } from '@/recipes/dashboard-stats';

<DashboardStats
  stats={[
    { label: 'Revenue', value: '$45,231', change: 12.5, changePeriod: 'from last month' },
    { label: 'Users', value: '2,350', change: -3.1, changePeriod: 'from last month' },
    { label: 'Orders', value: '1,234', change: 8.2 },
    { label: 'Conversion', value: '3.2%', change: 0.5 },
  ]}
  columns={4}
/>

Loading State

<DashboardStats stats={[]} columns={4} isLoading />

API Reference

PropTypeDefaultDescription
statsStatItem[]Array of stat items
columns1 | 2 | 3 | 44Number of grid columns
isLoadingbooleanfalseLoading skeleton state
classNamestringAdditional CSS classes

StatItem

interface StatItem {
  label: string;
  value: string | number;
  change?: number;
  changePeriod?: string;
  icon?: ReactNode;
}

On this page