Ranked rows with bars to scale for comparing named figures
pnpm dlx shadcn@latest add @notchset-pro/bar-listRanked rows: a name, a bar to scale and its figure; the pointed row lit.
Every shadcn style · one file
Import it and pass your content. The props that matter most are listed next.
"use client";
import { Card } from "@/components/ui/notchset/card";
import * as React from "react";
import { BarList } from "@/components/ui/notchset/bar-list";
import { SegmentedControl } from "@/components/ui/notchset/segmented-control";
/* Bar list: visits by traffic source, each row the source, its bar to scale and the value. Switch the month and the
bars race to their new lengths while the rows re-rank with a glide, each mover marked with the places it moved. Point
at or tab to a row and its bar lights in the source's own colour; press it to hold it (press again, or Escape, to let
go) and the line under the list names its share. The Order knob keeps the list's own order; the State knob shows a
long source name and nothing to rank. */
const WORDS = {
label: "Traffic by source",
long: "Newsletter, partner referrals and paid social campaigns",
empty: "No visits yet. Sources appear here once a page has traffic.",
};
type Period = "sep" | "oct";
const ROWS: { name: string; sep: [number, string]; oct: [number, string] }[] = [
{ name: "Search", sep: [112000, "38%"], oct: [96000, "31%"] },
{ name: "Direct", sep: [139000, "47%"], oct: [148000, "48%"] },
{ name: "Referral", sep: [168000, "57%"], oct: [182000, "59%"] },
{ name: "Newsletter", sep: [98000, "33%"], oct: [121000, "39%"] },
{ name: "Social", sep: [70000, "24%"], oct: [64000, "21%"] },
];
const k = (n: number) => `${Math.round(n / 1000)}k`;
export default function BarListDemo() {
const order: string = "ranked";
const funnel = order === "funnel";
const state = "ready" as "ready" | "long" | "empty";
const w = WORDS;
const [period, setPeriod] = React.useState<Period>("oct");
const [picked, setPicked] = React.useState<string | null>(null);
const rows = state === "empty" ? [] : ROWS.map((r, i) => ({ name: state === "long" && i === 3 ? w.long : r.name, value: r[period][0], text: k(r[period][0]), detail: r[period][1], hue: i + 1 }));
const pickedRow = rows.find((r) => r.name === picked);
return (
<Card inset className="w-full max-w-[var(--ns-width-md)] gap-3">
<div className="flex min-h-8 items-center justify-between gap-3">
<h3 className="m-0 text-[length:var(--ns-text-small)] font-[number:var(--ns-weight-medium)] text-[var(--ns-ink)]">{w.label}</h3>
<SegmentedControl size="sm" label="Month" value={period} onValueChange={(v) => setPeriod(v as Period)} options={[{ value: "sep", label: "Sep" }, { value: "oct", label: "Oct" }]} />
</div>
{/* the rows carry a quarter-step of side padding for their lit pill; pulled out, their names share the title's left edge */}
<BarList
className="-mx-1.5"
label={`${w.label}, ${period === "oct" ? "October" : "September"}`}
rows={rows.map(({ detail: _, ...r }) => r)}
keepOrder={funnel}
defaultActive={picked ?? undefined}
onSelect={(r) => setPicked(picked === r.name ? null : r.name)}
labels={{ empty: w.empty }}
/>
<p role="status" className={pickedRow ? "m-0 text-[length:var(--ns-text-small)] text-[var(--ns-ink-2)] tabular-nums" : "sr-only"}>
{pickedRow ? `${pickedRow.name}: ${pickedRow.text} visits, ${pickedRow.detail} of the total` : ""}
</p>
</Card>
);
}"use client";
import { Card } from "@/components/ui/notchset/card";
import * as React from "react";
import { BarList } from "@/components/ui/notchset/bar-list";
import { SegmentedControl } from "@/components/ui/notchset/segmented-control";
/* Bar list: visits by traffic source, each row the source, its bar to scale and the value. Switch the month and the
bars race to their new lengths while the rows re-rank with a glide, each mover marked with the places it moved. Point
at or tab to a row and its bar lights in the source's own colour; press it to hold it (press again, or Escape, to let
go) and the line under the list names its share. The Order knob keeps the list's own order; the State knob shows a
long source name and nothing to rank. */
const WORDS = {
label: "Traffic by source",
long: "Newsletter, partner referrals and paid social campaigns",
empty: "No visits yet. Sources appear here once a page has traffic.",
};
type Period = "sep" | "oct";
const ROWS: { name: string; sep: [number, string]; oct: [number, string] }[] = [
{ name: "Search", sep: [112000, "38%"], oct: [96000, "31%"] },
{ name: "Direct", sep: [139000, "47%"], oct: [148000, "48%"] },
{ name: "Referral", sep: [168000, "57%"], oct: [182000, "59%"] },
{ name: "Newsletter", sep: [98000, "33%"], oct: [121000, "39%"] },
{ name: "Social", sep: [70000, "24%"], oct: [64000, "21%"] },
];
const k = (n: number) => `${Math.round(n / 1000)}k`;
export default function BarListDemo() {
const order: string = "ranked";
const funnel = order === "funnel";
const state = "ready" as "ready" | "long" | "empty";
const w = WORDS;
const [period, setPeriod] = React.useState<Period>("oct");
const [picked, setPicked] = React.useState<string | null>(null);
const rows = state === "empty" ? [] : ROWS.map((r, i) => ({ name: state === "long" && i === 3 ? w.long : r.name, value: r[period][0], text: k(r[period][0]), detail: r[period][1], hue: i + 1 }));
const pickedRow = rows.find((r) => r.name === picked);
return (
<Card inset className="w-full max-w-[var(--ns-width-md)] gap-3">
<div className="flex min-h-8 items-center justify-between gap-3">
<h3 className="m-0 text-[length:var(--ns-text-small)] font-[number:var(--ns-weight-medium)] text-[var(--ns-ink)]">{w.label}</h3>
<SegmentedControl size="sm" label="Month" value={period} onValueChange={(v) => setPeriod(v as Period)} options={[{ value: "sep", label: "Sep" }, { value: "oct", label: "Oct" }]} />
</div>
{/* the rows carry a quarter-step of side padding for their lit pill; pulled out, their names share the title's left edge */}
<BarList
className="-mx-1.5"
label={`${w.label}, ${period === "oct" ? "October" : "September"}`}
rows={rows.map(({ detail: _, ...r }) => r)}
keepOrder={funnel}
defaultActive={picked ?? undefined}
onSelect={(r) => setPicked(picked === r.name ? null : r.name)}
labels={{ empty: w.empty }}
/>
<p role="status" className={pickedRow ? "m-0 text-[length:var(--ns-text-small)] text-[var(--ns-ink-2)] tabular-nums" : "sr-only"}>
{pickedRow ? `${pickedRow.name}: ${pickedRow.text} visits, ${pickedRow.detail} of the total` : ""}
</p>
</Card>
);
}This example also uses Card, Segmented control. This command installs them with it, so the example pastes as it is:
pnpm dlx shadcn@latest add @notchset-pro/bar-list @notchset/card @notchset/segmented-controlcomponents/ui/notchset/bar-list.tsx
This component is included with Pro.
Try the live preview above. Get Pro to install the source.
LevelAtom: uses no other piece.
Made ofNothing else from the library: the foundation alone.
Needs your registry key. Every components.json style gets the same files.
Works with React 18.3 or 19 on Tailwind CSS v4, in any shadcn project. What's tested
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
The sound you hear is this page's: the piece you install plays none, and calls onFeedback on each move so you can add your own.
label–
stringwhat is ranked and when, the list's accessible name
rows–
BarListRow[]Required.
format(n) => n.toLocaleString("en-US")
(n: number) => stringhow a value reads where `text` is not given
keepOrder–
booleankeep the given order (a funnel); else largest first
onSelect–
(row: BarListRow) => voidpressing a row (a button); with `href` a link instead
defaultActive–
stringthe row lit (held) at rest; default none
labels–
Partial<typeof BAR_LIST_LABELS>its words: what shows with no rows
onFeedback–
(e: FeedbackEvent) => voidcalled once per move, for your sound or haptics
Three usespipeline by stage · revenue by source · top pages this week
Give your coding assistant the Markdown guide instead of screenshots.
https://notchset.dev/api/mcp (setup)One payment, lifetime.
v2.0.0 · 2026-10-13
Released with the Notchset system.