Interactive Area Chart
A React SVG area chart with a crosshair that follows the pointer or arrow keys, showing the value and percent change against a dashed comparison line.
src/registry/ui/interactive-area-chart.tsx/r/interactive-area-chart.json
Revenue · Dec
$84k
+35.5% vs last yearRevenueLast year
JanFebMarAprMayJunJulAugSepOctNovDec
Hover or use arrow keys
Installation#
bash
npx shadcn@latest add https://ui.minidev.pro/r/interactive-area-chart.json
Usage#
tsx
import { InteractiveAreaChart } from "@/components/ui/interactive-area-chart"
export function Example() {
return (
<InteractiveAreaChart />
)
}
API reference#
| Prop | Type | Default |
|---|---|---|
data | Point[] | SAMPLE |
format | (n: number) => string | (n: number) => `$${n.toLocaleString()}k` |
label | string | "Revenue" |
compareLabel | string | "Last year" |
className | string | - |
Dependencies#
npm
React only
Built from
Examples#
Related charts components#
Area ChartDependency free SVG area chart for React with a smoothed line, dashed grid, gradient fill and an optional highlighted point. Strokes stay crisp at any size.Bar ChartLightweight React bar chart with rounded bars, dashed gridlines and labels. Hovering a bar dims the rest and shows its value; the peak is highlighted first.Chart CardCard wrapper for charts with a title, optional description and a minimum height body. Pairs with the area, bar and donut charts in a React dashboard.Chart LegendWrapping chart legend with small color swatches and labels. Pass colors per series or fall back to accent, success, warning and danger theme tokens.Chart Tooltip CardTooltip card for charts showing a title and label and value rows with tabular numbers. Drop it into any chart library's custom tooltip slot.Donut ChartSingle value donut chart in SVG that fills an accent ring to a percentage of max and prints the percent in the middle. Labelled as an image for screen readers.
All chart components