Skip to contentKino
Skip to Content

Bar chart

Values across categories, side by side, stacked or as shares, upright or lying. The category under the pointer stays bright while the rest step back, and every change of data, range or sort glides from where the bars are.

npx shadcn add https://kinoui.com/r/bar-chart.json
Share on

Examples

Notes captured

Every note the Kino team wrote, by where it was written.
Last 7 days1,942
CategoryWebiOSAndroid
Sun 8 November705529
Mon 9 November1547360
Tue 10 November1887666
Wed 11 November1658865
Thu 12 November1768870
Fri 13 November17012666
Sat 14 November775327

Stacked

stack puts the series side by side, stacked, or as shares of their total. A new range, a sort or a hidden series glides from where the bars are, and new data grows out of the loading placeholder.

Notes written

The first two weeks of November.
CategoryNotes written
Sun 1 November181
Mon 2 November189
Tue 3 November198
Wed 4 November207
Thu 5 November215
Fri 6 November114
Sat 7 November123
Sun 8 November242
Mon 9 November250
Tue 10 November259
Wed 11 November268
Thu 12 November276
Fri 13 November175
Sat 14 November184

Photos added

The first two weeks of November.
CategoryPhotos added
Sun 1 November129
Mon 2 November97
Tue 3 November65
Wed 4 November124
Thu 5 November92
Fri 6 November20
Sat 7 November79
Sun 8 November87
Mon 9 November145
Tue 10 November113
Wed 11 November82
Thu 12 November140
Fri 13 November68
Sat 14 November37

Synced

Charts in a ChartGroup share the category under the pointer or the focus, by its key.

Time to first reply

The median hours between a note being shared and its first comment, this month.
Target 4h
CategoryMedian reply
Support2.4 hrs
Field research5.8 hrs
Customer success and onboarding3.1 hrs
Design6.6 hrs
Engineering4.2 hrs
Target

Horizontal

orientation='horizontal' lays the bars along the categories, here with each value written past its bar and a target line.

Net revenue change

New and expanded plans, less refunds and cancelled plans.
CategoryNet change
June 2026$18,400
July 2026$9,200
August 2026-$6,800
September 2026-$2,100
October 2026$14,900
November 2026$22,300

Negative values

Bars below zero hang from it, in negativeColor when you give one.

Seats in use

Seats each team has filled on the Kino plan.
Average 69%
CategoryIn use
Support92%
Field research64%
Design38%
Engineering81%

Tracks

track draws each bar’s whole length behind it, for values out of a whole, and label='inside' writes the value at the bar’s end.

Cash flow

How Kino’s balance moved from October to November.
CategoryBalance
October$0 – $48,200
Plans$48,200 – $69,600
Upgrades$69,600 – $75,900
Refunds$75,900 – $71,000
Payroll$71,000 – $39,200
Tools$39,200 – $34,000
November$0 – $34,000

Waterfall

A value can be a [from, to] range: waterfall() turns each change into the step it makes from the last, and color picks a colour per bar.

Notes by project

Pick a project to see its notes.
CategoryNotes
Lisbon cafés128
Kestrel Bakery64
Harbour market92
Night buses37

Showing 92 notes from Harbour market

Picking a category

selected, defaultSelected or onSelectedChange lets a press, Enter or Space pick a category, which stays bright until another is picked.

Installation

npx shadcn@latest add https://kinoui.com/r/bar-chart.json
Files
lib/reduce-motion.tslib/scroll.tslib/refs.tslib/resize.tslib/swap.tsxlib/popup.tslib/glide.tsxcomponents/kino/tooltip.tsxlib/cut.tsxlib/announce.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/chart-math.tslib/controllable.tslib/number-format.tslib/chart-core.tsxlib/run-progress.tslib/highlight.tscomponents/kino/chart.tsxlib/placeholder.tscomponents/kino/bar-chart.tsx
Packages
@base-ui/reactclass-variance-authorityd3-array

New to Kino? Installation covers what your project needs first and the @kino namespace.

The CLI keeps any of these colours your project already has, such as the chart colours shadcn init writes. To use Kino’s, set them in your global CSS:

globals.css
:root {  --chart-1: oklch(0.62 0.16 250);  --chart-2: oklch(0.54 0.18 257);  --chart-3: oklch(0.47 0.21 263);  --chart-4: oklch(0.4 0.19 268);  --chart-5: oklch(0.33 0.15 272);}.dark {  --chart-1: oklch(0.82 0.09 245);  --chart-2: oklch(0.74 0.13 250);  --chart-3: oklch(0.67 0.17 257);  --chart-4: oklch(0.61 0.19 263);  --chart-5: oklch(0.55 0.2 268);}

API reference

BarChart

PropTypeDefaultDescription
dataChartDatum[]NoneOne row per category: the category under index, and a value under each series’ key. A value can be a number, a [from, to] range, or missing.
indexstringNoneThe key of each row’s category.
configChartConfigNoneEach series by its key: its label, color (or theme for light and dark), pattern and stack. shadcn’s chart config works as it is.
labelstringNoneWhat the chart shows, for screen readers, such as “Visitors by month”.
descriptionstringNoneA longer account for screen readers, such as the trend.
formatIntl.NumberFormatOptions(value: number) => stringNoneHow values are written in the tooltip, the labels, the table and, shortened, the value axis.
categoryFormat(value: unknown) => stringStringHow a category is written.
localeIntl.LocalesArgumentNoneThe locale numbers are written in. Give one, so the server and the browser agree.
orderedbooleanfalseThe categories run in order, such as days, so the tooltip gives each value’s change since the one before.
domain[number | 'auto', number | 'auto']['auto', 'auto']The ends of the value axis; auto fits the data and rounds out to a tick.
tickCountnumber5About how many ticks the value axis marks; fewer when the axis is short.
tickValuesnumber[]NoneThe ticks to mark, in place of round ones.
allowDecimalsbooleanNoneTicks between whole numbers; off when every value is whole.
patternsbooleanfalseA pattern over each series after the first.
hiddenSeriesstring[]NoneThe series hidden, with defaultHiddenSeries and onHiddenSeriesChange.
activeIndexnumber | nullNoneThe category under the pointer or the focus, with defaultActiveIndex and onActiveIndexChange.
selectedstring | nullNoneThe category picked, by its key, with defaultSelected and onSelectedChange. Giving any of them lets a press pick one.
loadingbooleanfalseShows a placeholder; the marks grow out of it when the data arrives.
errorReactNodeNonetrue for the chart’s own words, or what to say.
onRetry() => voidNoneAdds a Try again button beside the error.
emptyReactNodeNoneWhat shows when data is empty.
messagesPartial<ChartMessages>NoneEvery word the chart says or reads out, for another language.
orientation'vertical''horizontal''vertical'Upright bars over the categories, or bars lying along them.
stack'none''stacked''expand''none'Side by side, stacked, or stacked as shares of their total. Series with the same stack in the config stack together, beside the others.
entrance'none''rise''cascade''none'How the bars arrive the first time the chart comes into view. None by default, since a page that loads doesn’t animate into place.
cascadeFrom'start''end''centre''value''start'Where a cascade starts: either end, the centre, or the largest value.
categoryGapnumberNoneThe space between two categories, as a share of one category’s step.
barGapnumber0.12The space between bars side by side, as a share of one bar’s slot.

Bar

PropTypeDefaultDescription
dataKeystringNoneThe key of the series’ values in the data and in the config.
labelboolean'outside''inside''center'falseWrites each value on its bar: true puts it past the end. A label that doesn’t fit is left out.
labelFormatIntl.NumberFormatOptions(value: number) => stringNoneHow the labels write values; the chart’s format by default.
color(row, index) => string | undefinedNoneA colour for one bar from its row; the series’ colour when it returns nothing.
negativeColorstringNoneThe colour of a bar below zero.
trackbooleanfalseDraws each bar’s whole length behind it.
fill'solid''gradient''solid'The series’ colour, or the colour fading toward zero.

Data attributes

AttributeOnDescription
data-dimA bar and its labelIt steps back while another category or series is brought forward.

CSS variables

VariableSet it onDefaultDescription
--bar-chart-radiusBarChart, or anything above itvar(--control-radius-xs)The corner at a bar’s far end.
--bar-chart-max-thicknessBarChart, or anything above it4remHow thick a bar can grow when there are few categories.
--bar-chart-min-lengthBarChart, or anything above it0pxThe least length of a bar that isn’t zero, so a tiny value still shows.
--bar-chart-dimBarChart, or anything above it0.3How much colour a bar that steps back keeps. It keeps its lightness, so it keeps its contrast.
--bar-chart-cascadeBarChart, or anything above it0.8How much of one bar’s rise the cascade spreads across the bars.

Accessibility

  • The plot is one stop in the tab order: a slider over the categories. The arrow keys step, Home and End go to the ends, and each category’s values are read as the slider’s value.
  • A hidden table holds every value, for screen readers and for copying.
  • Loading, an error and new data are announced in a status region.
  • With patterns, each series after the first has a pattern as well as its colour, and forced colours draw each series in a system colour.
  • When the system asks for less motion, bars and labels move to their place at once and only fade.