Updated
Area Chart
Customize
number
Series2
Accent
Installation
npx shadcn@latest add https://uibrik.com/r/area-chart.jsonInstall the packages
npm install @number-flow/react @tabler/icons-react motion react-use-measureAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/area-chart/area-chart.tsx"use client"; import { useEffect, useId, useMemo, useRef, useState, type PointerEvent } from "react"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; import { cn } from "@/lib/utils"; import { Announce, ChartCard, DataTable, Delta, Headline, Legend, Tooltip, TooltipRow, TooltipTitle, useChartCursor, useWidth, areaPath, extent, linear, linePath, nearest, niceTicks, type Point,
Adds the files to
components/uibrik/area-chart and installs @number-flow/react, @tabler/icons-react, motion and react-use-measure. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/area-chart.Too large to paste whole, so Copy prompt gives a short prompt that installs it with the CLI. Download the full prompt to attach it instead.
Usage
import { AreaChart } from "@/components/uibrik/area-chart/area-chart";<AreaChart title="Visitors" format={{}} accent="" series={[{ key: "visitors", label: "Visitors" }]} headline="total" showGrid height={220} onActiveChange={(index) => {}} // data={[…]} // previous={[0]}/>Where to use Area Chart
Traffic and revenue trends
Soft area washes show volume over time while staying readable when several series overlap.
Pairs with KPI Tile
Comparing metrics
One crosshair reads every series at the same moment, so users compare signups, revenue and churn without hovering each line.
Pairs with Stacked Bars
Monitoring and analytics
A calm time-series chart fits product analytics and server metrics pages alike.
Pairs with Live Line
Props
AreaChart- title
- Type string
- "Visitors"
- Names what is plotted.
- format
- Type Intl.NumberFormatOptions
- {}
- Formats every number, e.g. { style: "currency", currency: "USD" }.
- accent
- Type string
- ""
- First series colour. Empty uses the chart palette.
- data
- Type ({ label: string } & Record<string, number>)[]
- –
- One row per period, oldest first, with a value per series key.
- series
- Type { key: string; label: string; color?: string }[]
- –
- The series to draw, 1 to 5.
- previous
- Type number[]
- –
- The first series over the previous period, drawn dashed for comparison.
- headline
- Type "total" | "latest"
- "total"
- Headline is the period's sum or its latest value.
- showGrid
- Type boolean
- true
- Grid lines with value labels.
- height
- Type number
- 220
- Plot height in px.
- onActiveChange
- Type (index: number | null) => void
- –
- Called with the row under the cursor.
- className
- Type string
- –
- Classes for the outer shell.