AreaChart
Area chart component for cumulative trends and stacked volumes
Area chart component built on Recharts for visualizing volume over time — optionally stacked to show how parts compose a total.
Built on Recharts
All chart components are built on Recharts with
pre-configured theming and responsive behavior. Recharts ships with
@telamonjs/ui — no separate install.
Basic Usage
import { AreaChart } from '@telamonjs/ui'
const data = [
{ name: 'Mon', visits: 1200 },
{ name: 'Tue', visits: 1900 },
{ name: 'Wed', visits: 1500 },
{ name: 'Thu', visits: 2200 },
{ name: 'Fri', visits: 2600 },
]
export default function TrafficChart() {
return <AreaChart data={data} dataKeys={['visits']} />
}The X axis reads the `name` field
Like the other charts, AreaChart takes flat dataKeys: string[], one area per key, with the
X axis fixed to the name field.
Props
Prop
Type
Examples
Stacked Areas
const data = [
{ name: 'Jan', organic: 4000, paid: 2400, referral: 800 },
{ name: 'Feb', organic: 3000, paid: 1398, referral: 900 },
{ name: 'Mar', organic: 5000, paid: 3200, referral: 1100 },
]
<AreaChart
data={data}
dataKeys={['organic', 'paid', 'referral']}
stacked
/>Use stacked when the series sum to a meaningful total (traffic sources,
revenue streams); leave it off to compare independent trends.
Overlapping Comparison
<AreaChart
data={data}
dataKeys={['thisYear', 'lastYear']}
colors={['#3b82f6', '#94a3b8']}
/>With React Query
'use client'
import { AreaChart } from '@telamonjs/ui'
import { useQuery } from '@tanstack/react-query'
import { metricsApi } from '@/lib/api/metrics-client'
export function TrafficBySource() {
const { data = [] } = useQuery({
queryKey: ['traffic-by-source'],
queryFn: metricsApi.trafficBySource,
})
return <AreaChart data={data} dataKeys={['organic', 'paid']} stacked />
}Lazy Variant
AreaChartLazy has the same props but code-splits the Recharts bundle:
import { AreaChartLazy } from '@telamonjs/ui'
<AreaChartLazy data={data} dataKeys={['visits']} />Best Practices
- Stack only real compositions - Stacked areas imply the total matters
- Order stacked series - Largest/most stable series at the bottom
- Name the X axis field
name- Map API data if needed - Prefer LineChart for many series - Overlapping areas get muddy past 2-3 series
Related Components
- LineChart - Trends without fill
- BarChart - Category comparison
- Donut - Composition at one point in time
- ChartWidget - Chart inside a dashboard card
Status: ✅ Stable