Skip to content

Step Line Chart for React

A React step line chart for values that hold and then jump, such as prices, plan limits and headcount. Pass data as readonly ChartRow[]: one object per point: the index key plus one number per series key.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/step-line-chart.json

Price per seat

  • Enterprise
  • Team
  • Pro
Use left and right arrow keys to read values.

  • StepLineChart
  • StepLineTable
  • defaultStepLineChartLabels
  • +1 more

Price changes

The curve sets where each label sits on its step: "step-after" (the value starts at its label), "step" (mid-step) or "step-before" (the value is reached at its label). The line is the same; only the anchors move. Prices sit far from zero, so zero={false} lets the axis hug them instead of squashing every step into the top of the plot.

Price per seat

Monthly list price by plan, US$

  • Enterprise
  • Team
  • Pro

Files to copy

11 folders · 26 files · 4 packages
From theme/src/
  • components/charts/{step-line-chart.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-utils.ts, range-area-chart.tsx}
  • components/charts/chart-parts/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/skeleton/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}
  • motion/tokens.ts
  • lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/step-line-chart.jsonRegistry item: step-line-chart. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".

With an area wash

One series, so no legend: the title names it. area keeps zero on the axis, so the wash fills to a real baseline.

Licensed seats

At the end of each month

262 seats

Props

PropTypeDefaultDescription
data (required)readonly ChartRow[]NoneOne object per point: the index key plus one number per series key.
index (required)stringNoneKey of the x value in each row (e.g. "month").
series (required)readonly ChartSeries[]NoneThe lines to draw. Give each a fixed color slot so filtering never repaints it.
curveStepCurve"step-after"Where each value's label sits on its step.
areabooleanfalseFill under each line with a soft 10% wash.
zerobooleantrueKeep zero on the value axis. Turn off for levels far from zero (prices, rates), so the steps aren't squashed into the top of the plot. Always on with area.
heightnumber260Height of the chart in px; the width follows the container.
format((n: number) => string)formatCompactFormats values in the tooltip and labels, and on the axis (the default axis format follows the tick step).
endLabelsbooleantrueLabel the end of each line (2–4 series, when the chart is wide enough and the labels don't collide).
emptyStateReactNodeNoneShown when there is nothing to plot.
labelsPartial<StepLineChartLabels>defaultStepLineChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultStepLineChartLabels. Its only key is listed in the key table under the props table.
aria-label (required)stringNoneAccessible summary of what the chart shows.
classNamestringNoneAdds extra classes to the outer element.
StepLineChartLabels keys and English defaults (1)
Pass any key in labels; the rest keep the defaults of defaultStepLineChartLabels.
KeyEnglish default
instructionsUse left and right arrow keys to read values.

StepLineTable props

PropTypeDefaultDescription
data (required)readonly ChartRow[]NoneThe rows to show: one object per row, holding the index key and one number per series key.
index (required)stringNoneThe key in each row that names the row, such as "month". It becomes the first column.
series (required)readonly CompareSeries[]NoneSeries to list as columns; one with a compareKey also gets a previous-period column.
format((n: number) => string)formatCompactFormats each number in the table cells.
indexLabelstringNoneHeader of the first column; the index key when left out.
captionstringNoneVisually hidden caption naming the table for screen readers.
labelsPartial<ChartTableLabels>defaultChartTableLabelsText for i18n (defaults come from the enclosing ChartCard's labels, else English). Every other string, for translation: labels={{ noData: "…" }}; omitted keys keep the English of defaultChartTableLabels. All 2 keys of ChartTableLabels are listed in the key table under the props table.
ChartTableLabels keys and English defaults (2)
Pass any key in labels; the rest keep the defaults of defaultChartTableLabels.
KeyEnglish default
noDataNo data
previous(label: string) => `${label} (previous)`

Keyboard

KeysAction
TabFocus the chart. It is one tab stop; the arrow keys then read it.
←/→ (↑/↓)Previous / next point.
Home/EndJump to the first / last point.
EscapeClear the reading.

Accessibility

  • The chart is a focusable figure named by its aria-label (the chart title), with a one-line reading hint as its description and, inside a ChartCard with a table view, aria-details pointing at that table; moving through it announces each value politely, once. Each move announces the point and its values.
  • StepLineTable is the table view (the same table as ChartTable): pass it as the ChartCard table prop. The Chart / Table tabs put every value in text, so none depends on color.
  • Reduced motion: the steps appear at their final values and data changes jump instead of morphing.

All exports on this page

  • StepLineChart — A line chart whose lines hold their value until the next change.
  • StepLineTable — The table view of a StepLineChart: one row per step on the x axis, one column per series.
  • defaultStepLineChartLabels — The built-in English strings of StepLineChart; spread it into your own labels and change what you need.

When to use the step line chart

  • Use it as a step chart for plan pricing over time, where a price holds flat until the next change, and the hover band marks the step each price holds for.
  • It fits licensed seats at the end of each month or headcount, where values hold between events and a smooth line would invent in-between numbers.
  • It also suits interest rates, quota limits or feature thresholds, with area adding a soft wash under a single series that keeps zero on the axis.
  • Skip it when the value changes continuously, such as temperature or traffic; LineChart is the honest shape, and RangeAreaChart fits when each point has a low and a high.
  • Pair it with ChartCard for the title and legend, a StepLineTable as the Chart / Table tab, and a segmented control to switch plans or ranges.

Frequently asked questions

48 charts pages in all: browse them on Charts.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .