Skip to main content

BarChart

Interactive

See BarChart in Storybook for every variant, with live controls.

A mini bar chart. Pure SVG, for small in-card comparisons.

import { BarChart } from "@kairosis/eidos";

<BarChart
data={[18, 24, 31, 22, 39, 44, 36]}
labels={["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]}
highlightIndex={5}
/>;

Props

PropTypeDefaultDescription
datanumber[]Required. Renders nothing when empty
labelsstring[][]Mono labels under each bar
widthnumber280px
heightnumber96px
colorstringvar(--primary)
highlightIndexnumberMarks the "current" bar in --secondary and dims the rest

Guidelines

  • highlightIndex is the one sanctioned use of orange here — it marks "current". One highlighted element per view, and it dims every other bar to 45% so the eye lands on it.
  • Bars scale to the largest value; there's no y-axis. This shows proportion, not absolute magnitude.
  • Zero and near-zero values still draw a 2px stub, so a bar never disappears entirely.
  • No tooltips or interaction. For values, put them in text.
  • aria-hidden — expose the underlying numbers elsewhere.