Bin
Line length
Adjacent bins, one hairline between. A density field on the 204.
Count
| Label | lines |
|---|---|
| 0–1 | 4 |
| 1–2 | 11 |
| 2–3 | 18 |
| 3–4 | 9 |
| 4–5 | 3 |
Shows a distribution in adjacent bins with 1px gaps.
Count
| Label | Count |
|---|---|
| 0–1 | 4 |
| 1–2 | 11 |
| 2–3 | 18 |
| 3–4 | 9 |
| 4–5 | 3 |
Line length
Adjacent bins, one hairline between. A density field on the 204.
Count
| Label | lines |
|---|---|
| 0–1 | 4 |
| 1–2 | 11 |
| 2–3 | 18 |
| 3–4 | 9 |
| 4–5 | 3 |
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { Histogram } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/histogram.
npx @noorddev/vlak-cli add histogram
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/histogram.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { Histogram } from "@noorddev/vlak-react";
<Histogram
height={204}
bins={[
{ label: "0–1", count: 4 },
{ label: "1–2", count: 11 },
{ label: "2–3", count: 18 },
]}
yLabel="Sessions"
/>| Prop | Type | Default | Description |
|---|---|---|---|
binsrequired | HistogramBin[] | ||
height | number | 204 | |
unit | string | ||
yLabel | string | ||
grid | boolean | true | |
ticks | number | 4 | |
valueFormat | (n: number) => string | ||
spot | string | boolean | ||
locale | string | BCP 47 tag for number formatting; undefined is the reader's own. |
Also accepts HTMLAttributes<HTMLDivElement>.
| Keys | Does |
|---|---|
| Tab | Focuses the plot |
| Arrow right, Arrow left | Moves the cursor across the bins; a status tooltip reads the count |
| Home, End | First or last bin |
| Escape | Clears the cursor |
<div class="rs-chart"><svg viewBox="0 0 240 64" width="240" height="64"><rect class="rs-chart-hist" x="8" y="36" width="36" height="20"/><rect class="rs-chart-hist" x="45" y="20" width="36" height="36"/><rect class="rs-chart-hist" x="82" y="8" width="36" height="48"/><rect class="rs-chart-hist" x="119" y="24" width="36" height="32"/></svg></div>