DocsComponentsTemplatesThemesGitHub

Dashboard

Stats, chart and recent orders.

Install

npx shadcn@latest add https://design.fruitlabs.online/r/template-dashboard.json

Code

import { Badge, BarChart, Card, Grid, Stack, StatTile, Table } from '@fruit-labs/design';

const orders = [
  { id: 'A-1042', customer: 'Ada Lovelace', total: '₹12,400', status: 'Paid' },
  { id: 'A-1043', customer: 'Marco Kim', total: '₹3,150', status: 'Pending' },
  { id: 'A-1044', customer: 'Jia Song', total: '₹8,900', status: 'Paid' },
];

export default function Template() {
  return (
    <Stack gap={4}>
      <Grid min={180}>
        <StatTile label="Revenue" value="₹4.2L" delta="12%" trend="up" footnote="vs. last month" />
        <StatTile label="Orders" value="318" delta="8%" trend="up" footnote="vs. last month" />
        <StatTile label="Refunds" value="6" delta="2" trend="down" good footnote="vs. last month" />
      </Grid>
      <Card><BarChart title="Weekly sales" labels={['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']} series={[{ name: 'Orders', data: [42, 55, 48, 63, 71, 39] }]} height={200} /></Card>
      <Table
        caption="Recent orders"
        rowKey="id"
        rows={orders}
        columns={[
          { key: 'id', header: 'Order' },
          { key: 'customer', header: 'Customer' },
          { key: 'total', header: 'Total', align: 'right' },
          { key: 'status', header: 'Status', render: (r) => <Badge tone={r.status === 'Paid' ? 'success' : 'warning'} dot>{r.status}</Badge> },
        ]}
      />
    </Stack>
  );
}