Controls

Area Chart

Effect
Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Area Chart

Revenue by day
dayRevenue
Mon$4.2K
Tue$5.1K
Wed$4.8K
Thu$6.3K
Fri$7.9K
Sat$9.4K
Sun$8.1K

Area Chart

A line chart with a soft fill that fades down to its baseline.

Installation

npx shadcn@latest add ikislay/pixel-ui/area-chart

How to use

import { AreaChart } from "@/components/ui/area-chart"
const data = [
{ day: "Mon", revenue: 4200 },
{ day: "Tue", revenue: 5100 },
{ day: "Wed", revenue: 4800 },
]
export function Demo() {
return (
<AreaChart
label="Revenue by day"
data={data}
index="day"
series={[{ key: "revenue", label: "Revenue" }]}

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
data*
Record<string, string | number>[]

One object per point along the x axis.

index*
string

The key in each object that labels the x axis.

series*
{ key: string; label?: string; color?: string }[]

The keys to plot. Colors follow the chart palette in order unless you set one.

label*
string

Names the chart for screen readers and captions its data table.

height
number

Height in pixels. The width fills the parent.

format
(value: number) => string

Formats values wherever the chart shows them. Defaults to short numbers like 12.4K.

curve
smoothlinear

Smooth bends through every point without overshooting it; linear joins them with straight lines.

className
string

Merged onto the root element.