Infographic Bar
Composable continuous stat-card band. Lays out N stat-cards as a single infographic strip — outer corners rounded, inner corners square, hairline dividers, no full per-card borders. Theme-portable across bordered and borderless palettes.
Preview
A KPI row that reads as one continuous band — not four separate cards butting together. The band owns the frame, radius, and elevation; each stat-card sheds its own chrome.
Highlighted cell
Set variant: "highlight" on any cell to tint it. Only the surface changes — the band's continuous frame and dividers stay intact.
Compact density
Pass size="sm" to tighten every cell for dense dashboards.
Selectable band (a filter)
Pass value, defaultValue or onValueChange and the band becomes a filter: a radiogroup whose cells are radios, one pressed. Each cell draws its value over a sentence-case caption, and the pressed plate slides between cells. Arrow keys move focus and selection together; the band is one tab stop. The cell id is the value reported by onValueChange.
A selectable cell shows value and label only; delta, trend, footer, variant and valueAs apply to the read-only band.
Installation
npx visor add infographic-barThis copies two files into your project:
components/ui/infographic-bar/infographic-bar.tsx— the componentcomponents/ui/infographic-bar/infographic-bar.module.css— the styles
StatCard and ToggleGroup (the selectable band's radiogroup) are installed automatically as dependencies.
Usage
import { InfographicBar } from '@/components/ui/infographic-bar/infographic-bar';
export default function Example() {
return (
<InfographicBar
stats={[
{ label: 'Total Revenue', value: '$48,120', delta: { value: '+12.4%', direction: 'up', label: 'vs last month' } },
{ label: 'Active Users', value: '892', delta: { value: '+3.1%', direction: 'up' } },
{ label: 'Churn Rate', value: '3.2%', delta: { value: '-0.4%', direction: 'down' } },
]}
/>
);
}Theming
InfographicBar is theme-agnostic and reads correctly in both bordered and borderless palettes:
- Outer frame uses
--border-default. Borderless themes set this totransparent, so the band's frame drops away and it melts into the page. - Dividers use
--hairline— the house soft-separator token, lighter than a full border. Override--infographic-bar-dividerto retune them, includingtransparentfor a fully seamless band. - Corners round via
overflow: hiddenon the band, so outer cells round and inner cells stay square for any number of cells.
The selectable band has no border and sits on one tint:
- Band is the page mixed 6% toward the ink (
--infographic-bar-bg); on a pure-black page a 3% white layer fades in so the band still reads. - Pressed plate is a lifted plate on a light page (the page mixed 60% toward white, plus
--shadow-sm) and a 9% ink wash in dark. It reads the page and the ink, not a mode class, so an always-dark theme's light mode still gets the wash. Override with--infographic-bar-plate-bgand--infographic-bar-plate-shadow. - Size follows the approval-inbox drawing: a 4px inset with concentric inner corners (
--radius-xlless the inset,--infographic-bar-radiusto retune), cells at least 124px wide (--infographic-bar-cell-min-width), a 44px count (--infographic-bar-value-size) and a 13px caption (--infographic-bar-caption-size). Below 720px the band spans its container and the count drops to 32px.
API Reference
InfographicBarProps
| Prop | Type | Default | Description |
|---|---|---|---|
stats* | InfographicBarStat[] | — | Ordered stat cells, rendered left-to-right as a single continuous band. Each item is a subset of StatCardProps (label, value, delta, trend, trendPosition, footer, variant, valueAs) plus an optional id. |
stats[].label* | React.ReactNode | — | Label describing the metric. Uppercase in a read-only band; a selectable band draws it as a sentence-case caption under the value. |
stats[].value* | React.ReactNode | — | Prominent metric value rendered in a large display size. |
stats[].delta | StatCardDelta | — | Change indicator with value, direction ("up" | "down" | "flat"), and optional context label. |
stats[].variant | 'default' | 'highlight' | 'default' | Per-cell visual emphasis. Highlight tints that cell’s surface; the band frame and dividers stay continuous. |
stats[].id | string | — | Stable React key for the cell, and its value in a selectable band. Falls back to the array index (as a string) when omitted. |
size | 'sm' | 'md' | 'md' | Dimensional density forwarded to every cell of a read-only band. |
value | string | — | Selected cell id (controlled). Passing value, defaultValue or onValueChange makes the band selectable: a radiogroup filter with one cell pressed. |
defaultValue | string | — | Uncontrolled initial selection. Falls back to the first cell. |
onValueChange | (value: string) => void | — | Fires with the newly selected cell id. Never fires with an empty string. |
className | string | — | Additional CSS class names merged onto the band element. |
...props | React.HTMLAttributes<HTMLDivElement> | — | All standard HTML attributes are forwarded to the band div. |
The component also forwards all standard HTML attributes to the band <div>.
InfographicBarStat
Each entry in stats is a subset of StatCardProps: label, value, delta, trend, trendPosition, footer, variant, valueAs, plus an optional id used as the React key.
Accessibility
Each cell is a StatCard, which announces its delta direction (up, down, flat) to screen readers via visually-hidden text alongside the visible glyph — color is never the sole signal. The cells default to <article> landmarks, so the band exposes one landmark per metric.
A selectable band is a radiogroup (name it with aria-label); each cell is a radio with aria-checked, named by its value and caption ("7 waiting"). Arrow keys move focus and selection together, and the band is one tab stop.
Filter Bar
Admin filter bar compound — search input, filter controls slot, removable active-filter chips, results count, and a clear-all affordance above a data-table. Built with CSS Modules and container queries — copy it into your project and own it completely.
Kbd
Tiny primitive for rendering keyboard shortcuts using the semantic <kbd> element. Supports a single key via children or a multi-key sequence via the keys prop with a customizable separator. Built with CSS Modules — copy it into your project and own it completely.