{"name":"comparison-bars","entry":"component","title":"ComparisonBars","description":"Readable comparison rows on a shared zero-based scale, with optional emphasis.","category":"UI","capabilities":[],"needsRemotion":false,"registryDependencies":["@jbm/tokens"],"install":"npx shadcn@latest add @jbm/comparison-bars","installName":"comparison-bars","page":"https://jbm-ui.bns.studio/c/comparison-bars","registryItem":"https://jbm-ui.bns.studio/r/comparison-bars.json","sourcePath":"registry/jbm/ui/comparison-bars.tsx","files":[{"source":"registry/jbm/ui/comparison-bars.tsx","target":"src/jbm/ui/comparison-bars.tsx","import":"@/jbm/ui/comparison-bars","type":"registry:ui"}],"endpoints":{"markdown":"https://jbm-ui.bns.studio/catalog/comparison-bars.md","json":"https://jbm-ui.bns.studio/catalog/comparison-bars.json"},"snippet":"import { ComparisonBars } from \"@/jbm/ui/comparison-bars\"\n\n<ComparisonBars max={100} formatValue={(v) => `${v} lecturas`} items={[\n  { label: \"Contexto\", value: 42 },\n  { label: \"Una buena pregunta\", value: 68 },\n  { label: \"Una idea clara\", value: 90, highlight: true },\n]} />\n// Values must be nonnegative; max must cover all values.","api":[{"export":"ComparisonBars","kind":"component","summary":"Description list of rows: label and formatted value on one line, then a 14px bar whose fill is value / max of the full width. Highlighted rows use vermilion for the value and fill; others use dim text and an ink fill. Bars are aria-hidden, so the text carries the data. Throws RangeError for negative or non-finite values, or a max that is not positive or below any value.","props":[{"name":"items","type":"{ label: string; value: number; highlight?: boolean }[]","required":true,"default":null,"description":"Rows in display order: label, a finite nonnegative value, and optional highlight to mark the one emphasized row."},{"name":"max","type":"number","required":false,"default":null,"description":"Shared scale ceiling. Defaults to the largest value (at least 1); set it to compare against a fixed range such as 100."},{"name":"formatValue","type":"(value: number) => string","required":false,"default":"String","description":"Formats each value for its readout, e.g. (v) => `${v}%`."}],"passthrough":["React.HTMLAttributes<HTMLDivElement>"]}],"stage":{"mode":"fluid","reason":"Width fills its container; bars span the full row width. Each row is about 40 stage pixels (15px label line, 4px row gap, 4px margin, 14px bar), with 20px between rows, so height grows with items. Long labels or values wrap and add lines."},"examples":[{"title":"Three rows on a 0–100 scale","code":"import { ComparisonBars } from \"@/jbm/ui/comparison-bars\"\n\n<ComparisonBars max={100} formatValue={(v) => `${v} lecturas`} items={[\n  { label: \"Contexto\", value: 42 },\n  { label: \"Una buena pregunta\", value: 68 },\n  { label: \"Una idea clara\", value: 90, highlight: true },\n]} />\n// Values must be nonnegative; max must cover all values."}],"qa":["Check fills are proportional to value / max, a zero value shows an empty track, and a value equal to max fills the row.","Only the highlighted row uses vermilion; keep a single highlight per figure.","At narrow widths long labels wrap above their values and bars stay full width.","Read without the bars (they are aria-hidden): each dt/dd pair still states the label and value."],"related":[{"name":"tokens","relation":"installs"}],"docs":[{"title":"Visual primitives guide","url":"https://jbm-ui.bns.studio/docs/visual-primitives.md"}],"setup":{"namespace":"@jbm","componentsJson":{"registries":{"@jbm":"https://jbm-ui.bns.studio/r/{name}.json"}},"command":"npx shadcn@latest add @jbm/<name>","target":"src/jbm/","importAlias":"@/jbm/…","tsconfigPaths":{"@/*":["./src/*"]}},"rules":["Install through the @jbm namespace: each registry item JSON (/r/<name>.json) carries its files' contents and each guide is served at /docs/<slug>.md, so agents never need the source repository (it is public on GitHub for people browsing the code).","Files install to src/jbm/ and import as @/jbm/…, which needs the @/* → ./src/* path alias in tsconfig.json.","Items marked needsRemotion require the remotion package and must render inside a Remotion composition or Player; every other item works in any React page.","Use one vermilion accent per composition; accent2 is for annotations only and soft is for dark surfaces only.","Stages are 1920×1080 landscape and 1080×1920 vertical with declared safe areas; each item's stage field declares its size in stage pixels, and scenes compose from YAML-shaped specs with @jbm/scene-spec."],"links":{"catalog":"https://jbm-ui.bns.studio/catalog.json","llms":"https://jbm-ui.bns.studio/llms.txt"}}