Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Line Chart

ProNew

Smooth lines that draw in from the left, with a snapping crosshair and a tooltip for every series.

Installation

pnpm dlx shadcn@latest add @viewport/line-chart

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
title*string

Accessible title for the chart.

—
labels*string[]

X-axis labels, one per data point.

—
series*Series[]—
format(value: number) => string

Formats values for the axis, the tooltip and the data table.

(v) => v.toLocaleString("en-US")
heightnumber

Chart height in pixels.

240
areaboolean

Shade the area under each line.

true
classNamestring—

Accessibility

  • The same data is provided as a visually hidden table.
  • Arrow keys, Home and End move the crosshair; values are announced.
  • Appears fully drawn under reduced motion.