# Bar list (Notchset): prompt.md (v2.0.0)

- id: `bar-list` · version 2.0.0 · component · pro (Pro)
- category: Charts
- build: one set of files for every shadcn style
- install: `npx shadcn@latest add @notchset-pro/bar-list`
- npm dependencies: none
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json
- docs: https://notchset.dev/components/bar-list
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

Ranked rows (pipeline by stage, revenue by source): the name, a bar to scale against the largest and its figure, with a quieter count after it. Bars rest at the series' soft tint; the row you point at or focus lights in the series hue with the list's one glow. With href or onSelect each row opens what it ranks..

## Build it
- Stack: React 18.3 or 19, TypeScript, Tailwind CSS v4 utility classes on the foundation's roles, a components.json (imports use its aliases).
- Packages: none beyond `react` and `react-dom`.
- Files: `components/ui/notchset/bar-list.tsx`; shared code: `lib/notchset/feedback.ts`, `lib/notchset/hit-area.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `notchset-foundation`.
- Builds: one set of files, the same for every shadcn style.
- Exports to keep: `BarList`, `BAR_LIST_LABELS`, and every exported type.
- CSS: the install adds the notchset foundation (its roles, keyframes and motion switch, reading your shadcn tokens for colour) to your global stylesheet once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- This item reads `--ns-cat-`, `--ns-ease`, `--ns-ease-move`, `--ns-glow`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-line-soft`, `--ns-press-min`, `--ns-radius-sm`, `--ns-series`, `--ns-signal`, `--ns-text-meta`, `--ns-text-small`, `--ns-time-color`, `--ns-time-sweep`, `--ns-weight-medium`.
- Retune it (on any ancestor) with the foundation's roles and hooks: `--ns-agent-b`, `--ns-agent-c`, `--ns-agent-d`, `--ns-agent-drift`, `--ns-agent-fill`, `--ns-agent-h1`, `--ns-agent-h2`, `--ns-agent-h3`, `--ns-agent-shift`, `--ns-avatar-card`, `--ns-avatar-lg`, `--ns-avatar-md`, `--ns-avatar-sm`, `--ns-avatar-xs`, `--ns-bad`, `--ns-bad-ink`, `--ns-band`, `--ns-band-edge`, `--ns-band-grade`, `--ns-band-optimal`, `--ns-banner-beat`, `--ns-banner-radius`, `--ns-beat`, `--ns-beat-ease`, `--ns-bezel`, `--ns-bloom-close`, `--ns-bloom-open`, `--ns-bloom-rise`, `--ns-btn-bad`, `--ns-btn-bad-hover`, `--ns-btn-bad-line`, `--ns-btn-bezel`, `--ns-btn-chosen`, `--ns-btn-gone`, `--ns-btn-morph`, `--ns-btn-ok`, `--ns-btn-press`, `--ns-btn-release`, `--ns-btn-result`, `--ns-btn-roll`, `--ns-btn-stagger`, `--ns-btn-stagger-step`, `--ns-btn-tick`, `--ns-btn-tonal`, `--ns-btn-tonal-edge`, `--ns-btn-tonal-hover`, `--ns-bulk-clear`, `--ns-button`, `--ns-button-field-inset`, `--ns-button-lg`, `--ns-button-sm`, `--ns-canvas`, `--ns-card-tilt`, `--ns-cat-1`, `--ns-cat-2`, `--ns-cat-3`, `--ns-cat-4`, `--ns-cat-5`, `--ns-cat-6`, `--ns-check`, `--ns-check-round`, `--ns-cheer-1`, `--ns-cheer-2`, `--ns-cheer-3`, `--ns-cheer-edge`, `--ns-cheer-fold`, `--ns-cheer-glow`, `--ns-cheer-lift`, `--ns-chip`, `--ns-chip-pick`, `--ns-control`, `--ns-control-lg`, `--ns-control-pad`, `--ns-control-sm`, `--ns-corner`, `--ns-danger`, `--ns-deep`, `--ns-deep-ink`, `--ns-deep-ink-2`, `--ns-deep-line`, `--ns-depth-card`, `--ns-depth-lift`, `--ns-depth-surface`, `--ns-dialog`, `--ns-dialog-grow`, `--ns-dialog-lg`, `--ns-dialog-max`, `--ns-dialog-shrink`, `--ns-dialog-sm`, `--ns-dialog-top`, `--ns-dock-bottom`, `--ns-drop`, `--ns-ease`, `--ns-ease-arrive`, `--ns-ease-breathe`, `--ns-ease-drum`, `--ns-ease-exit`, `--ns-ease-fling`, `--ns-ease-glide`, `--ns-ease-grow`, `--ns-ease-move`, `--ns-ease-panel`, `--ns-ease-pop`, `--ns-ease-press`, `--ns-ease-spring`, `--ns-ebg-arm`, `--ns-ebg-lit`, `--ns-emoji`, `--ns-emoji-md`, `--ns-emoji-sm`, `--ns-field`, `--ns-field-edge`, `--ns-field-h`, `--ns-fill`, `--ns-fill-time`, `--ns-flood-arc`, `--ns-flood-aurora`, `--ns-flood-behind-1`, `--ns-flood-behind-2`, `--ns-flood-bloom`, `--ns-flood-deep`, `--ns-flood-dial-bloom`, `--ns-flood-glass`, `--ns-flood-grain`, `--ns-flood-image`, `--ns-flood-ink`, `--ns-flood-ink-low`, `--ns-flood-light`, `--ns-flood-mid`, `--ns-flood-pale`, `--ns-flood-pane`, `--ns-flood-pane-edge`, `--ns-flood-pill-ink`, `--ns-flood-ribbon`, `--ns-flood-ribbon-core`, `--ns-flood-shadow`, `--ns-flood-sheen`, `--ns-flood-wash`, `--ns-font-body`, `--ns-font-display`, `--ns-font-mono`, `--ns-font-script`, `--ns-glass`, `--ns-glass-blur`, `--ns-glass-shadow`, `--ns-glow`, `--ns-glyph-pad`, `--ns-grain`, `--ns-gutter`, `--ns-header`, `--ns-help-max`, `--ns-hit`, `--ns-hover`, `--ns-icon`, `--ns-icon-lg`, `--ns-icon-sm`, `--ns-icon-stroke`, `--ns-info`, `--ns-info-ink`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-ink-4`, `--ns-layer-bar`, `--ns-layer-modal`, `--ns-layer-panel`, `--ns-layer-popup`, `--ns-layer-sticky`, `--ns-layer-tip`, `--ns-layer-toast`, `--ns-layer-zoom`, `--ns-lead-body`, `--ns-lead-figure`, `--ns-lead-large`, `--ns-lead-meta`, `--ns-lead-small`, `--ns-lead-sub`, `--ns-lead-title`, `--ns-leading`, `--ns-leading-prose`, `--ns-leading-title`, `--ns-lift`, `--ns-light-1`, `--ns-light-2`, `--ns-light-3`, `--ns-light-spread`, `--ns-light-strength`, `--ns-line`, `--ns-line-soft`, `--ns-lit-edge`, `--ns-map-grass`, `--ns-map-water`, `--ns-mark-edge`, `--ns-mark-lifted`, `--ns-mark-rest`, `--ns-mark-swap`, `--ns-marker`, `--ns-marker-ink`, `--ns-mc-place`, `--ns-mc-roll`, `--ns-measure`, `--ns-menu-dy`, `--ns-menu-lit`, `--ns-menu-pad`, `--ns-menu-row`, `--ns-menu-rule`, `--ns-mesh`, `--ns-mesh-frost`, `--ns-nest-inset`, `--ns-nest-outer`, `--ns-nest-r`, `--ns-notch-ease`, `--ns-ok`, `--ns-ok-ink`, `--ns-on-fill`, `--ns-orb-body`, `--ns-orb-cool`, `--ns-orb-core`, `--ns-orb-dawn`, `--ns-orb-deep`, `--ns-orb-edge`, `--ns-orb-grain`, `--ns-orb-ground`, `--ns-orb-halo`, `--ns-orb-inner`, `--ns-orb-key`, `--ns-orb-lift`, `--ns-orb-limb`, `--ns-orb-limb-from`, `--ns-orb-rim`, `--ns-orb-skin-hi`, `--ns-orb-skin-lo`, `--ns-orb-skin-mid`, `--ns-orb-warm`, `--ns-palette-min`, `--ns-panel`, `--ns-panel-room`, `--ns-panel-w`, `--ns-panel-w-lg`, `--ns-pick-slot`, `--ns-pill-prop`, `--ns-play-fill`, `--ns-play-fill-color`, `--ns-play-lift`, `--ns-play-lift-y`, `--ns-play-open`, `--ns-play-open-content`, `--ns-play-press`, `--ns-play-press-box`, `--ns-play-reduced`, `--ns-play-ring`, `--ns-play-roll`, `--ns-play-shake`, `--ns-play-spring`, `--ns-play-swap`, `--ns-play-swap-blur`, `--ns-press-min`, `--ns-press-scale`, `--ns-press-x`, `--ns-press-y`, `--ns-primary-hover`, `--ns-primary-press`, `--ns-prism-edge`, `--ns-prism-glint`, `--ns-prism-sheen`, `--ns-prism-tint`, `--ns-pulse`, `--ns-radius`, `--ns-radius-2xl`, `--ns-radius-button`, `--ns-radius-button-lg`, `--ns-radius-button-sm`, `--ns-radius-card`, `--ns-radius-check`, `--ns-radius-control`, `--ns-radius-control-sm`, `--ns-radius-float`, `--ns-radius-full`, `--ns-radius-lg`, `--ns-radius-mark`, `--ns-radius-menu-row`, `--ns-radius-modal`, `--ns-radius-pill`, `--ns-radius-sm`, `--ns-radius-xl`, `--ns-radius-xs`, `--ns-raised`, `--ns-ramp-1`, `--ns-ramp-2`, `--ns-ramp-3`, `--ns-ramp-4`, `--ns-ramp-5`, `--ns-ramp-shine`, `--ns-range`, `--ns-rest-1`, `--ns-rest-2`, `--ns-rest-3`, `--ns-rise`, `--ns-row`, `--ns-row-compact`, `--ns-row-hue`, `--ns-scrim`, `--ns-search-h`, `--ns-segment`, `--ns-segment-inset`, `--ns-segment-lift`, `--ns-segment-sm`, `--ns-selected`, `--ns-series`, `--ns-series-core`, `--ns-series-glint`, `--ns-series-tint`, `--ns-shadow-dialog`, `--ns-shadow-float`, `--ns-shadow-lift`, `--ns-shadow-panel`, `--ns-sheet`, `--ns-sheet-back`, `--ns-sheet-bottom`, `--ns-sheet-drop`, `--ns-sheet-rise`, `--ns-shift`, `--ns-side`, `--ns-signal`, `--ns-signal-ink`, `--ns-signal-wash`, `--ns-sk-figure`, `--ns-sk-land`, `--ns-sk-p`, `--ns-sk-p0`, `--ns-sk-p1`, `--ns-sk-p2`, `--ns-sk-p3`, `--ns-sk-p4`, `--ns-sk-p5`, `--ns-sk-p6`, `--ns-sk-p7`, `--ns-sk-read`, `--ns-sk-sweep`, `--ns-skeleton`, `--ns-skeleton-bone`, `--ns-skeleton-bone-light`, `--ns-skeleton-light`, `--ns-slab`, `--ns-slab-edge`, `--ns-slab-ink`, `--ns-sleep-awake`, `--ns-sleep-deep`, `--ns-sleep-light`, `--ns-sleep-rem`, `--ns-space-1`, `--ns-space-2`, `--ns-space-3`, `--ns-space-4`, `--ns-space-5`, `--ns-space-6`, `--ns-space-8`, `--ns-space-section`, `--ns-stack-fan`, `--ns-stack-fan-gap`, `--ns-stack-fan-lag`, `--ns-stack-on`, `--ns-stagger-item`, `--ns-stagger-mark`, `--ns-stagger-max`, `--ns-standing-critical`, `--ns-standing-in`, `--ns-standing-out`, `--ns-state-doing`, `--ns-state-done`, `--ns-state-review`, `--ns-state-todo`, `--ns-step`, `--ns-step-from`, `--ns-step-sign`, `--ns-swipe-surface`, `--ns-switch-h`, `--ns-switch-w`, `--ns-text-body`, `--ns-text-control`, `--ns-text-control-lg`, `--ns-text-display`, `--ns-text-editorial`, `--ns-text-empty`, `--ns-text-figure`, `--ns-text-giant`, `--ns-text-heading`, `--ns-text-headline`, `--ns-text-input`, `--ns-text-large`, `--ns-text-lede`, `--ns-text-meta`, `--ns-text-record`, `--ns-text-sentence`, `--ns-text-small`, `--ns-text-sub`, `--ns-text-title`, `--ns-theme-fade`, `--ns-tile-shadow`, `--ns-time-born`, `--ns-time-color`, `--ns-time-confirm`, `--ns-time-dialog`, `--ns-time-fling`, `--ns-time-flip`, `--ns-time-glide`, `--ns-time-grow`, `--ns-time-hold`, `--ns-time-menu`, `--ns-time-page`, `--ns-time-panel`, `--ns-time-quick`, `--ns-time-roll`, `--ns-time-settle`, `--ns-time-snap`, `--ns-time-spin`, `--ns-time-spring`, `--ns-time-sweep`, `--ns-time-toast`, `--ns-tint`, `--ns-tint-c`, `--ns-tint-ease`, `--ns-tint-fill`, `--ns-tint-gap`, `--ns-tint-h1`, `--ns-tint-h2`, `--ns-tint-h3`, `--ns-tint-ink`, `--ns-tint-row`, `--ns-tip-fold`, `--ns-tip-grow`, `--ns-toast-bottom`, `--ns-toast-gap`, `--ns-toast-left`, `--ns-toast-lift`, `--ns-toast-peek`, `--ns-toast-scale`, `--ns-toast-w`, `--ns-touch`, `--ns-tracking-body`, `--ns-tracking-caps`, `--ns-tracking-control`, `--ns-tracking-display`, `--ns-tracking-headline`, `--ns-tracking-sub`, `--ns-tracking-title`, `--ns-warn`, `--ns-warn-ink`, `--ns-wash-clay`, `--ns-wash-dusk`, `--ns-wash-graphite`, `--ns-wash-ink`, `--ns-wash-sage`, `--ns-wash-sand`, `--ns-weight-light`, `--ns-weight-medium`, `--ns-weight-regular`, `--ns-weight-strong`, `--ns-well`, `--ns-width-lg`, `--ns-width-md`, `--ns-width-sm`, `--ns-width-xl`.
- Never add Tailwind colour classes inside the component.

```tsx
import { Card } from "@/components/ui/notchset/card";
```

## Parts
- A single export that takes props.

## Match the original
- Read `components/ui/notchset/bar-list.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- A few categories ranked by one figure, read across.

### Not when
- Values over time are Bar chart; parts of one whole are Split bar.

## Built from
- Feedback (shared helper, ships with it)
- Hit area (shared helper, ships with it)

## Mistakes
- Using it for values over time: that is Bar chart
- More than about ten rows: show the top ones and a View detail
- Mixing units between rows

## Usage

```tsx
"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` (https://notchset.dev/components/card), `segmented-control` (https://notchset.dev/components/segmented-control). Installing this item doesn't bring them; to paste the example as it is: `npx shadcn@latest add @notchset-pro/bar-list @notchset/card @notchset/segmented-control`. The `@notchset-pro` items are Pro: they need the registries in components.json and the key (Setup).

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `label` | `string` |  | what is ranked and when, the list's accessible name |
| `rows` | `BarListRow[]` |  | Required. |
| `format` | `(n: number) => string` | `(n) => n.toLocaleString("en-US")` | how a value reads where `text` is not given |
| `keepOrder` | `boolean` |  | keep the given order (a funnel); else largest first |
| `onSelect` | `(row: BarListRow) => void` |  | pressing a row (a button); with `href` a link instead |
| `defaultActive` | `string` |  | the row lit (held) at rest; default none |
| `labels` | `Partial<typeof BAR_LIST_LABELS>` |  | its words: what shows with no rows |
| `onFeedback` | `(e: FeedbackEvent) => void` |  | called once per move, for your sound or haptics |

Full docs: https://notchset.dev/components/bar-list

## Customising
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- Dark mode follows the `.dark` class or `data-theme="dark"` on an ancestor (the shadcn and next-themes conventions).
- Update later: Commit or stash local changes first (or copy the files), so the update can be undone. Read https://notchset.dev/r/changelog.json for the new versions: a major version, an entry marked breaking or a merge says what to change. Then re-run the install with `--overwrite`, on a branch. It replaces the component's files, the shared helper files they import, and the item's CSS rules in the global stylesheet, so review the whole diff (components, shared files, CSS), re-apply your own edits, and run the app's typecheck, tests and build.

## Keyboard

| Keys | Action |
|---|---|
| Tab | row to row (when rows open something); the focused row lights |
| Enter | open the row |

## Performance

- One row of markup per item and a bar that animates its width only when the figures change.
- Installs no npm dependency.
- Past a few dozen rows, show the top ones and link to the rest.

## Responsive

- phone: narrower name and count columns
- desktop
- dark (tokens)
- reduced motion: widths land at once

## Motion inventory

| Interaction | What moves |
|---|---|
| a row's moved-by figure fades in | ns-fade on --ns-time-sweep. Reduced motion: already only a fade; it stays. |
| the lit row's bar and words brighten | opacity, color and box-shadow, --ns-time-color. Reduced motion: the same (a colour change, nothing moves). |
| a bar grows to its width when the figures change | width, --ns-time-sweep, --ns-ease-move. Reduced motion: the width lands at once. |
| press: a row that opens what it ranks sinks a little and springs back | data-ns-press: down to --ns-press-scale (0.99, a wide row) in --ns-time-quick on --ns-ease-press, back in --ns-time-spring on --ns-ease-spring; colours on --ns-time-color. Reduced motion: no scale under either switch; the colours still change. |

## Accessibility contract (preserve when editing)
- A list named by its label; each row reads its name, figure and count in order; with href or onSelect each row is one tab stop (a link or a button).

## Install

```bash
# npm
npx shadcn@latest add @notchset-pro/bar-list
# pnpm
pnpm dlx shadcn@latest add @notchset-pro/bar-list
# yarn
yarn dlx shadcn@latest add @notchset-pro/bar-list
# bun
bunx --bun shadcn@latest add @notchset-pro/bar-list
```

Pro item: needs the `@notchset-pro` registry in `components.json` and `NOTCHSET_TOKEN` in `.env.local` (https://notchset.dev/account). Setup: https://notchset.dev/docs/pro. Every components.json `style` gets the same files.

### Manual

1. Install the packages: none beyond `react` and `react-dom`.
2. Copy `components/ui/notchset/bar-list.tsx`, `lib/notchset/feedback.ts`, `lib/notchset/hit-area.ts` from https://notchset.dev/r/pro/bar-list.json, sent with the header `Authorization: Bearer ${NOTCHSET_TOKEN}` (each file's `content`, at its `target`), keeping the `@/` path alias of your tsconfig.
3. Add what it builds on: shadcn `utils` (cn), `notchset-foundation`.

## Continue the workflow

- [Activity heatmap](https://notchset.dev/components/activity-heatmap)

The foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://notchset.dev/r/notchset-foundation.json.
