The key-figure strip: tiles edge to edge in the pixel face, status shape before the value, qualifier, sub-line, trace, struck-and-replaced value, one shared size per strip, ticker dropdown on desktop.
Click a figure: what it would open shows here.
$ npx shadcn@latest add @highcommand/figure-tileCopies the source into your project and pulls in what it needs (4 other items). First time? Add the registry to components.json.
One key-figure tile: label, value in the pixel face, optional status, qualifier, sub-line and trace; the whole tile is a link or a button that opens the figure's records.
idrequiredstring—`data-kpi`: the figure's key.
labelrequiredReactNode—The glossary's name (a node when it carries more, such as Command's short form).
valuerequiredstring—The figure as shown.
openrequiredFigureOpen—What a click on the tile does (see `FigureOpen`).
shortstring—The glossary's short form, printed instead of the name when the strip is narrow (AR, AP, Open SOs).
namestring—The accessible name's lead when `label` is not plain text.
titlestring—The definition: the tile's tooltip.
statusFigureStatus | null—The figure's status: a shape before the value, and the value in the status colour.
statusLabelstring—The status shape's name where the workspace means something else by it (Command: on track is "Better than normal").
dir'above' | 'below' | null—An arrow after the value, where the figure is off its band the way that needs action.
qualifierReactNode—A faint qualifier after the value, for its period or part ("of 50"). Text only: the tile is the control.
subReactNode—The sub-line: a `FigureSub` or `FigureSubLink`.
traceReactNode—The trace: a control of its own (Command's 7-day line over the normal band).
asideReactNode—Beside the figure, in the room the number leaves (the shift's line and the change since the person left).
verbstring—The accessible name's last sentence (what the click does); defaults by `open`.
detailstring—Sentences between the figure and the verb in the accessible name (the band, the impact line).
testidstring—`data-testid` of the tile.
actionTestidstring—`data-testid` of the tile's link or button.
dataRecord<`data-${string}`, string | undefined>—Extra data attributes on the tile (state, tone).
struckbooleantrueStrike the figure it replaced for STRUCK_MS when it changes (DESIGN.md "Struck and replaced").
classNamestring—Extra class on the tile.
<FigureMark />2 propsThe status shape (colour is never the only cue).statusrequiredFigureStatus—Picks the shape and colour.
labelstring—The shape's accessible name; default "On track", "At risk", "Late" or "Blocked".
<FigureSub />5 propsA sub-line: words in the sans, figures in the mono (`FigureNum`, or a `SV` that opens its own records above the tile).childrenReactNode—The sub-line's words and figures.
classNamestring—Extra class on the sub-line.
testidstring—`data-testid` of the sub-line.
titlestring—Tooltip.
toneFigureStatus | null—Colours the whole sub-line with a status token.
<FigureSubLink />7 propsA sub-line that opens exactly its own records (AR past due, AP due in 7 days): a link or a button above the tile's own action.childrenrequiredReactNode—The sub-line's words and figures.
hrefstring—Makes it a link to this address; without it the sub-line is a button.
onClick() => void—Called on click when it is a button (no `href`).
numstring—`data-num` label on the button, naming the figure it opens.
testidstring—`data-testid` of the link or button.
titlestring—Tooltip.
ariaLabelstring—Accessible name; replaces the visible text for assistive technology.
<FigureStrip />8 propsThe strip: a region with its heading (read by assistive tech only) whose width the tiles lay out by.labelstring'Key figures'The strip's heading, read by assistive technology only (default "Key figures").
idstring—Id of the strip's section; the heading's id is built from it.
testidstring—`data-testid` of the tiles' container.
classNamestring—Extra class on the strip's section.
tickerboolean—The strip is a ticker (ticker.css): its tiles are one line each, their trace and sub-line a dropdown. The caller says when (`useTickerOn`: a desktop); left out, the strip is as its parent set it (KpiStrip's groups read their own provider).
containerbooleantrueThe strip lays out by its own width (narrow: one row, the figures in the mono, no sub-lines); off where columns hold more under each tile.
childrenReactNode—The strip's tiles (`FigureTile`s).
countnumber—Tiles in the strip (sets `--units`, the columns the strip lays out).
<FigureNum />2 propsA figure inside a label or sub-line that is not a control of its own: the mono, tabular.childrenrequiredReactNode—The figure's text.
toneFigureStatus | null—Colours the figure with a status token.
useNarrow(px?: number): booleanWhether the viewport is at most `px` wide (a phone): false on the server and the first paint.
useTickerOn(editing?: boolean): booleanWhether a strip is a ticker: on a desktop, and not while its layout is being arranged (`editing`: the full cards show then).
useTickerNear<E extends HTMLElement>(ticker: boolean): { ref: RefObject<E | null>; inert: true | undefined; on: Record<string, unknown>; }A cell's dropdown is inert until a pointer or the focus is in the cell (nothing in it is a target or in the tab order before then; a key reaching the cell's action opens it, and the next Tab goes into it). A pointer already over the cell when the ticker comes on (it does after the first paint, or under a page restored by Back) sends no enter: the cell is read as it stands then, and any move over it counts as arriving.
FigureTicker(props: ProviderProps<boolean>): ReactNodeThe strip says so: its cells' bar and facts are a dropdown, so they are no click target until the pointer or the focus is in the cell.
fitFigures(root: HTMLElement, current: number): numberOne size for every figure in a strip, and never wider than its tile. The figures keep the strip's own size and face (the kpi role) wherever they fit; where the tightest tile has less room, every figure in the strip takes the same smaller scale, so they still read as one row of one size. A tile's room is its value line less everything else on it (the status shape, a qualifier such as "of 50") and their margins. The result is a scale factor (at most 1) the strip sets as `--kpi-k`; its stylesheet sizes `.kpi-n` by it (`calc(var(--kpi-k) * 1em)`), so the base size stays whatever the strip's stylesheet gives the value line. `current` is the factor the figures are drawn at now.
nextScale(current: number, measured: number): numberThe scale to draw at next: the measured one, unless it is within 0.01 of the current one (a rounding step), so a strip never re-renders back and forth between two neighbouring scales.
useFigureFit(ref: RefObject<HTMLElement | null>, ...figures: unknown[]): { k: number; mono: boolean; }`fitFigures` for a strip, again when `figures` (what its figures are made from) or the fit changes, and whenever the strip's width changes.
Install this free piece now; the Pro pieces drop in on top of it, in the same app. Pro is $79 once.