Skip to content
synccn

Line Chart

Multi-series lines with a toggleable legend and shared tooltip.

Traffic by source

Visits in thousands. Click a legend item to hide it.

Installation

$ pnpm dlx shadcn@latest add @synccn/line-chart

First time in this project? Connect synccn with one command.

Usage

import { LineChart } from "@/components/ui/charts";<LineChart labels={months} series={[{ name: "Search", values }]} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

LineChart

Multi-series line chart with a legend and a shared crosshair. series: [{ name, values: number[] }]

  • labelsrequired
    string[]

    X-axis labels.

  • seriesrequired
    { name: string; values: number[] }[]

    One entry per line.

  • height
    number

    Default 220

    Chart height in pixels.

  • format
    (value: number) => React.ReactNode

    Default (v) => v

    Formats ticks and tooltip values.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: img, meter
  • ARIA attributes: aria-label, aria-pressed, aria-valuemax, aria-valuemin, aria-valuenow