Ballmac UI home

Chart Line

A line chart with four curves, dots or value labels, dashed series, labels at the end of each line instead of a legend and gaps for missing data, in a frame with a table view, a toggling legend, patterns and states.

6/6 checksv1.0.0Updated Oct 18, 2026
What changed

Accounts

Active and trial, January to June

6 points. Active: from 8,420 in Jan to 13,650 in Jun; highest 13,650 in Jun, lowest 8,420 in Jan. Trial: from 2,110 in Jan to 3,710 in Jun; highest 3,710 in Jun, lowest 2,110 in Jan.

Installation

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

Usage

import { ChartLine } from "@/components/ballmac/chart-line"

The full example is in the Code tab above.

Examples

Linear with dots

Sprint velocity

Story points completed

7 points. Points: from 31 in S12 to 47 in S18; highest 47 in S18, lowest 29 in S14.

Actual against plan

Revenue against plan

The dashed line is the plan

6 points. Actual: from $21,400 in Jul to $33,600 in Dec; highest $33,600 in Dec, lowest $21,400 in Jul. Plan: from $21,000 in Jul to $33,500 in Dec; highest $33,500 in Dec, lowest $21,000 in Jul.

Labels on the lines

Customers by office

Hundreds, labeled on the lines instead of in a legend

5 points. Oslo: from 41 in 2021 to 52 in 2025; highest 52 in 2025, lowest 41 in 2021. Lima: from 33 in 2021 to 51 in 2025; highest 51 in 2025, lowest 33 in 2021. Pune: from 27 in 2021 to 55 in 2025; highest 55 in 2025, lowest 27 in 2021. Reno: from 22 in 2021 to 28 in 2025; highest 28 in 2025, lowest 22 in 2021.

Value labels

Net promoter score

Weekly survey

6 points. NPS: from 31 in W1 to 41 in W6; highest 42 in W5, lowest 31 in W1.

Step

Plan price

Changes only when the price changes

7 points. Price: from $9 in Jan to $19 in Dec; highest $19 in Dec, lowest $9 in Jan.

Gaps for missing data

Cold room temperature

The sensor was offline on Wednesday and Thursday

7 points. Temperature: from 21.4°C in Mon to 21.9°C in Sun; highest 23.6°C in Fri, lowest 21.4°C in Mon.

Five series with patterns

Latency by region

Milliseconds. Turn series off in the legend, or switch Patterns on

6 points. New York: from 82 ms in 00 to 101 ms in 20; highest 124 ms in 16, lowest 79 ms in 04. Frankfurt: from 71 ms in 00 to 93 ms in 20; highest 112 ms in 16, lowest 69 ms in 04. Singapore: from 164 ms in 00 to 168 ms in 20; highest 182 ms in 12, lowest 158 ms in 04. São Paulo: from 142 ms in 00 to 147 ms in 20; highest 163 ms in 12, lowest 139 ms in 04. And 1 more series, in the table.

API reference

PropTypeDefault
curve

How the line moves between points.

"monotone" | "linear" | "step" | "natural""monotone"
dots

Draw a dot on every point.

booleanfalse
dashed

Series keys drawn dashed, for forecasts or targets: dashes tell lines apart without color.

string[][]
directLabels

Write each series' name at the end of its line, so people read it without finding the legend.

booleanfalse
labels

Write the value on every point.

booleanfalse
gaps

Keep the gap where a value is missing instead of joining the points either side.

booleanfalse
grid"horizontal" | "both" | "none""horizontal"
yAxisbooleantrue
yFormatter(value: number) => string—
yDomain[number | "auto", number | "auto"]—
referenceLines{ y: number; label: string }[]—
tooltip"line" | "dot" | "dashed" | "none""line"
y*number—
label*string—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Arrow keysMove between data points (accessibilityLayer)
Tab, Enter / SpaceLegend buttons switch series; the Chart / Table switch shows the numbers as a table
DashesDashed lines tell series apart without color; patterns add dash styles to every other line

Quality scorecard

6/6

Every applicable check passes

Measured in Chromium 153.0.8010.12 on October 19, 2026, on version 1.0.0, across 8 examples.

How we measure
  • Passed: Accessibility scan

    No serious or critical issues in light and dark, on a phone and a desktop (axe-core 4.13.0, WCAG 2.1 AA and best-practice rules).

  • Passed: Small screens

    No sideways scrolling at 360, 390 or 1280 px wide.

  • Passed: Reduced motion

    No endless animation to begin with.

  • Not applicable: Right to left

    Not mirrored by design: Recharts draws its axes in SVG coordinates, which do not mirror.

  • Passed: Clean console

    No console errors or React hydration errors while loading.

  • Passed: Keyboard

    26 tab stops, each showing a visible change when it takes focus. 3 documented keys.

  • Not applicable: Loading, empty and error

    Does not show data or take submissions.

  • Passed: Automated tests

    Covered by charts-batch-families.test.tsx.

  • For information: Footprint

    2.5 KB of source (gzip) in 1 file. Installs recharts.

Automated checks find a subset of problems and do not replace testing with a screen reader and a keyboard in your own app. What they miss.

Use with AI

<ChartLine title description data xKey series={[{ key, label, color? }]} />. curve: monotone | linear | step | natural. Also dots, dashed (series keys), directLabels (write names at the line ends and drop the legend), labels (values on points), gaps (null breaks the line), yFormatter, yDomain, referenceLines, legend, patterns, state and every ChartFrame prop. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Chart Line (@ballmac/chart-line) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Trends where the exact path matters and fills would get in the way
  • Several series that cross (use directLabels)
  • Forecast against actual (dashed)

Not for

  • Part-to-whole over time (use chart-area with stack)
  • Comparing a few categories (use chart-bar)

Registry JSON: https://ui.ballmac.com/r/chart-line.json

Credits

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.