A small dashboard

Billing overview

KPI cards with sparklines, a bar chart and a refresh status.

Preview

Billing overview

Updated 09:30

Revenue this month

$84,210

+1.5% vs last month

Open invoices

17

3 overdue

Sign-ups by channelMobile is closing the gap: 82% of web sign-ups in Q4, up from 69% in Q1.
  • Web
  • Mobile
Use the arrow keys to move between data points, Home and End to jump to the first and last.
Example.tsx
import { BarChart, Sparkline } from '@reactloom/charts';
import { Button, Card, Heading, SimpleGrid, Stack, Text } from '@reactloom/ui';
import { useState } from 'react';

const kpis = [
  { label: 'Revenue this month', value: '$84,210', change: '+1.5% vs last month', trend: [61, 58, 67, 70, 73, 69, 75, 77, 80, 81, 83, 84] },
  { label: 'Open invoices', value: '17', change: '3 overdue', trend: [31, 28, 30, 26, 24, 25, 22, 21, 19, 20, 18, 17] },
];

const channels = [
  { quarter: 'Q1', web: 1240, mobile: 860 },
  { quarter: 'Q2', web: 1385, mobile: 1010 },
  { quarter: 'Q3', web: 1460, mobile: 1195 },
  { quarter: 'Q4', web: 1610, mobile: 1320 },
];

export default function Example() {
  const [updated, setUpdated] = useState('09:30');
  return (
    <section aria-labelledby="billing-dashboard" style={{ width: '100%' }}>
      <Stack gap="4">
        <Stack direction="row" justify="between" align="center" wrap gap="2">
          <Heading level={3} id="billing-dashboard">
            Billing overview
          </Heading>
          <Stack direction="row" gap="3" align="center">
            {/* Polite and atomic: one short sentence after each refresh, not every number. */}
            <Text size="sm" tone="muted" role="status" aria-atomic="true">
              Updated {updated}
            </Text>
            <Button size="sm" variant="secondary" onClick={() => setUpdated(updated === '09:30' ? '09:45' : '09:30')}>
              Refresh
            </Button>
          </Stack>
        </Stack>
        <SimpleGrid minChildWidth="14rem" gap="4">
          {kpis.map((k) => (
            <Card key={k.label}>
              <Stack gap="1">
                <Text size="sm" tone="muted">
                  {k.label}
                </Text>
                <Text size="2xl" weight="semibold">
                  {k.value}
                </Text>
                <Text size="sm">{k.change}</Text>
                <Sparkline data={k.trend} label={`${k.label}, last 12 months`} type="area" width={200} height={32} />
              </Stack>
            </Card>
          ))}
        </SimpleGrid>
        <Card>
          <BarChart
            title="Sign-ups by channel"
            description="Mobile is closing the gap: 82% of web sign-ups in Q4, up from 69% in Q1."
            data={channels}
            x="quarter"
            series={[
              { key: 'web', label: 'Web' },
              { key: 'mobile', label: 'Mobile' },
            ]}
            height={220}
          />
        </Card>
      </Stack>
    </section>
  );
}

Numbers first, pictures second

  • Put the number in text. A KPI card is a label, a value and a change in words (“+1.5% vs last month”). The sparkline adds the shape of the trend; its accessible name repeats the range (“61 to 84, up 37.7%”), so nothing depends on seeing it.
  • Say what a chart shows. Give each chart a description with the takeaway. Without one, ReactLoom charts generate a factual summary (range, extremes, change), which is accurate but does not know what matters to your readers.
  • Offer the data. Every chart has a “Show data table” toggle with a real, sortable table, the most reliable alternative for screen-reader users and for anyone who needs exact values.
  • Don’t rely on colour. The chart palette reaches 3:1 against the background in every theme, legends and tooltips name each series, and Windows high-contrast mode switches to dash patterns.

Refreshing without noise

Dashboards update. If every number is a live region, a screen reader reads the whole page on each refresh. Instead, announce one short, atomic status — “Updated 09:45” — and let people read the numbers when they want them. Announce changes individually only when someone has to act (a payment failed, a threshold was crossed), and then use a Toast or an Alert.

Layout and structure

  • Use headings for each area and a landmark for the dashboard (<section aria-labelledby>), so people can jump between areas.
  • Card and SimpleGrid reflow from several columns to one without media queries; check the page at 320 px wide.
  • For an application frame with navigation, start from AppShell and the KPI cards recipe.