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.jsonPrice per seat
- Enterprise
- Team
- Pro
StepLineChartStepLineTabledefaultStepLineChartLabels- +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
import { formatCompact, type ChartSeries } from "@/components/sheenui/charts/chart-utils";
import { StepLineChart } from "@/components/sheenui/charts/step-line-chart";
// Package build (after the first npm release, or a packed tarball): import { StepLineChart, formatCompact, type ChartSeries } from "@sheenui/theme";
const pricing = [
{ month: "Jan", pro: 42, team: 50, enterprise: 60 },
{ month: "Feb", pro: 45, team: 50, enterprise: 60 },
{ month: "Mar", pro: 45, team: 54, enterprise: 60 },
{ month: "Apr", pro: 45, team: 54, enterprise: 66 },
{ month: "May", pro: 48, team: 57, enterprise: 66 },
];
const series: ChartSeries[] = [
{ key: "enterprise", label: "Enterprise", color: 3 },
{ key: "team", label: "Team", color: 2 },
{ key: "pro", label: "Pro", color: 1 },
];
export function Example() {
return (
<StepLineChart
curve="step-after"
zero={false}
data={pricing}
index="month"
series={series}
format={(n) => "$" + formatCompact(n)}
aria-label="Monthly price per seat, by plan"
/>
);
}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.tsxcomponents/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.tslib/{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
import { StepLineChart } from "@/components/sheenui/charts/step-line-chart";
// Package build (after the first npm release, or a packed tarball): import { StepLineChart } from "@sheenui/theme";
const seats = [
{ month: "Jan", seats: 120 },
{ month: "Feb", seats: 135 },
{ month: "Mar", seats: 150 },
{ month: "Apr", seats: 180 },
{ month: "May", seats: 210 },
{ month: "Jun", seats: 262 },
];
export function Example() {
return (
<StepLineChart
area
curve="step-before"
data={seats}
index="month"
series={[{ key: "seats", label: "Seats" }]}
aria-label="Licensed seats at the end of each month"
/>
);
}Props
StepLineChartLabels keys and English defaults (1)
StepLineTable props
ChartTableLabels keys and English defaults (2)
Keyboard
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
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .