Skip to main content

LineChart

Multi-series line / area chart with a nice auto y-axis, gridlines, x labels, legend and a hidden data table for screen readers.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

Multi-series line / area chart with a nice auto y-axis, gridlines, x labels, legend and a hidden data table for screen readers.

Accessibility​

Each chart ships an accessible fallback (a visually-hidden data table / aria-label summary) so the data is available to screen readers, not just sighted users. Colour is paired with shape/label, never used alone.

Install and import​

npx shadcn@latest add @prism/line-chart
import { LineChart } from '@/components/prism/LineChart';

In a no-build prototype, read it from the bundle instead: const { LineChart } = window.PrismDesignSystem_39d121;

Examples​

Area + target line

<LineChart labels={days}
series={[{ name: "Revenue", data: rev, area: true },
{ name: "Target", data: target, dashed: true }]}
formatY={(v) => "$" + v + "k"} />

Props​

PropTypeRequiredDescription
seriesLineSeries[]Yes
labelsstring[]—
heightnumber—
showGridboolean—
showLegendboolean—
showDotsboolean—
yTicksnumber—
formatY(v: number) =&gt; React.ReactNode—
captionstring—