Skip to main content
Area charts display quantitative data over a continuous interval, with the area between the axis and the line filled. They are ideal for showing trends over time.

Basic area chart

Stacked area chart

For comparing multiple data series:

Gradient fill

For a polished look, use a gradient fill:

Styling guidelines

  • Use fillOpacity={0.2} for single-series charts
  • Use fillOpacity={0.3} for stacked charts (so overlapping areas are visible)
  • Use type="monotone" for smooth curves, type="linear" for straight segments
  • Set strokeWidth={2} for the line stroke
  • Use CartesianGrid with strokeDasharray="3 3" and className="stroke-border" for grid lines
  • Use className="text-xs fill-muted-foreground" on axis components for themed labels

Responsive sizing

Wrap in ChartContainer with a height class:
The ChartContainer uses ResponsiveContainer internally, so the chart fills the available width automatically.