Skip to content

Lollipop Chart for React

A React lollipop chart gives all the reading of a bar chart with a fraction of the ink: a thin stem and a dot per value. Pass data as readonly LollipopItem[]: takes one item per stem: { label, value }.

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

Feature adoption

Use the up and down arrow keys to read each item.

  • LollipopChart
  • LollipopTable
  • defaultLollipopChartLabels
  • +1 more

Ranked, with an average

Feature adoption across accounts. Change the order and every row slides to its new place; the dashed line marks the average. Hover, tap or arrow through the rows.

Feature adoption

Share of active accounts using each feature, last 30 days. Highlighted: this quarter's launches.

Upright, around a baseline

Month-on-month change in signups. Values below the baseline reach down, so growth and decline read at a glance; the sign is in every label, never only in the direction.

Signup growth

In 2025, the change on the previous month

Files to copy

15 folders · 30 files · 4 packages
From theme/src/
  • components/charts/{histogram.tsx, lollipop-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-pointer.tsx, chart-tip.tsx, chart-utils.ts, heatmap.tsx}
  • components/charts/chart-parts/
  • components/charts/heatmap/
  • components/charts/histogram/
  • components/charts/kits/
  • components/charts/lollipop-chart/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/skeleton/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-direction.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/lollipop-chart.jsonRegistry item: lollipop-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".

Props

PropTypeDefaultDescription
data (required)readonly LollipopItem[]NoneTakes one item per stem: { label, value, color? }.
layout"horizontal" | "vertical" | "auto""auto""auto": sideways rows (best for ranked lists and long names), upright on wide charts with short names.
sort"none" | "ascending" | "descending""none"Order of the items. "none" keeps the order of data. Re-sorting slides the rows to their new places.
baselinenumber0Where the stems start. Values below it reach the other way (a diverging lollipop).
reference{ value: number; label: string; }NoneA reference line, e.g. { value: 72, label: "Average" }.
highlightstring | string[]NoneEmphasise these items (by label); the rest step back to a neutral grey.
showValuesbooleantruePrint each value next to its head.
colorChartColor1Sets the palette slot (1–8) used for the whole chart.
heightnumber300Height of an upright chart. Sideways charts grow with the number of rows.
valueLabelstringNoneNames the value axis.
format((n: number) => string)formatCompact in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
localestring"en"Locale of the default number format.
emptyStateReactNodeNoneShown when there is nothing to plot.
labelsPartial<LollipopChartLabels>defaultLollipopChartLabelsEvery other string, for translation: labels={{ roleDescription: "…" }}; omitted keys keep the English of defaultLollipopChartLabels. All 8 keys of LollipopChartLabels are listed in the key table under the props table.
aria-label (required)stringNoneNames the chart for assistive tech (required).
classNamestringNoneAdds extra classes to the outer element.
LollipopChartLabels keys and English defaults (8)
Pass any key in labels; the rest keep the defaults of defaultLollipopChartLabels.
KeyEnglish default
roleDescriptionlollipop chart
instructions({ horizontal }) => `Use the ${horizontal ? "up and down" : "left and right"} arrow keys to read each item.`
hintTap a row to read it
valueValue
versus(reference) => `vs ${reference}`
rank(rank, of) => `#${rank} of ${of}`
itemItem
noDataNo data

LollipopTable props

PropTypeDefaultDescription
data (required)readonly LollipopItem[]NoneTakes one item per stem: { label, value, color? }.
format((n: number) => string)formatCompact in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
sort"none" | "ascending" | "descending""none"Order of the items. "none" keeps the order of data. Re-sorting slides the rows to their new places.
labelsPartial<LollipopChartLabels>defaultLollipopChartLabelsEvery other string, for translation: labels={{ roleDescription: "…" }}; omitted keys keep the English of defaultLollipopChartLabels. All 8 keys of LollipopChartLabels are listed in the key table under the props table.
localestring"en"Locale of the default number format.
valueLabelstringNoneNames the value axis.
reference{ value: number; label: string; }NoneA reference line, e.g. { value: 72, label: "Average" }.
captionstringNoneHidden caption that names the table for screen readers.
classNamestringNoneAdds extra classes to the outer element.

Keyboard

KeysAction
TabFocus the chart. It is one tab stop; the arrow keys then read it.
Arrow keysAlong the item axis (↑ / ↓ for horizontal, ← / → for vertical): previous / next item.
Home/EndJump to the first / last item.
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 item, its value and its difference from the reference line.
  • LollipopTable is the same data as a real table. Pass it to ChartCard's table prop and the Chart / Table tabs let anyone read every value without color or sight.
  • Under reduced motion nothing morphs: the stems and dots render at their final values and new data replaces the old at once.

All exports on this page

  • LollipopChart — A lollipop chart: a thin stem from the baseline to a dot at each value.
  • LollipopTable — Every item with its value (and its difference from the reference line), in the chart's order.
  • defaultLollipopChartLabels — The built-in English strings of LollipopChart; spread it into your own labels and change what you need.

When to use the lollipop chart

  • Use it as a ranked chart when a bar chart would feel heavy, such as top customers by revenue or countries by NPS, since thin stems make small differences between long values visible.
  • Use reference to draw an average or target line, and highlight to emphasize the items that matter while the rest step back to neutral gray.
  • Set baseline when the stems should not start at zero; values below it reach the other way, which gives a diverging lollipop around a midpoint.
  • Skip it when you have only two or three items, where a plain Bar chart is clearer, or when each item has a before and after value, where a Dumbbell chart shows the change.
  • Pair it with ChartCard and LollipopTable for a text view, plus SegmentedControl to flip sort between descending and ascending, and Badge to label the reference value.

Frequently asked questions

48 charts pages in all: browse them on Charts.

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