Skip to content
microcharts
ReferenceExpressiveDicePips

DicePips

DicePips renders a small count of 0–6 as die pips, and shows the exact numeral above six.

encodes
canonical pip pattern 1–6 (subitized)
precision
high
nodes
≤ 7 (face + 6 pips)
collection
Expressive
Source

DicePips prints a small count as a die face: five pips for 5, an empty face for 0. The canonical 1–6 patterns are subitizable, so you read them without counting. Zero means zero, not missing data. Above six there is no pattern to subitize, so the face shows the exact numeral instead of inventing a seven-pip layout.

DicePips
interactive · 3.2 kB · static · 1.71 kB

Install

Import & usereact/dice-pips
import { DicePips } from "@microcharts/react/dice-pips";<DicePips value={4} title="Severity" />
Needs package + stylesheetSet up with AI

Try it

Live playground
onSelect
idle
  1. hover · click · Enter…

Tap to roll — the pip set cross-fades to the new face and the value is announced through a polite live region. The pips are one value, so there is no cursor to move.

value · 4
face
import { DicePips } from "@microcharts/react/dice-pips/interactive";<DicePips  value={4}/>

When to use it

Use it for a severity or rating 0–6 in a cell, a small count in a sentence, or an incident-severity badge. For counts above six use TallyMarks, for magnitudes MiniBar, and for proportions Progress.

Sizing

pips-only for dense columns
above 6 shows the exact numeral — no invented pattern

Variants

pips-only + numeral fallback

The face outline is on by default because it keeps a lone die legible on any surface. face={false} drops it for a repeated table column, where the header already frames the column. The second demo is the numeral fallback at value={9}.

Edge cases

zero — a real empty face, not missing data
a negative or invalid value reads 'No data.'
non-integers round to the nearest face

Four homes

In a sentence

Incident severity — rated 4 of 6, elevated but not critical.

In a table cell
INC-1424
INC-1412
INC-1405
In a KPI card
Severity
4of 6
In a tab header
INC-142INC-141INC-140

Preview uses the public chart API only. When an interactive twin exists, it swaps in with the same props and no entrance motion - code samples stay on the static import. Placement recipes: Composition, Sizing.

Accessibility

The accessible name states the value against its range: "4 out of 6." Past six it drops the range and gives the number alone ("9."). Zero reads "0 out of 6." and an invalid value reads "No data." The interactive entry pops the pips into place on change — a short scale-up with a per-pip stagger, skipped under prefers-reduced-motion — and announces the new face through a polite live region. The pips are one value, so there is no cursor to move.

This chart is a single unit, so there is nothing to rove between: a click, tap, Enter or Space selects it and fires onSelect, and no selection stays pinned. That is the scalar half of the shared interaction contract.

Props

PropTypeNotes
value*numberInteger 0–6 (rounded); above 6 shows a numeral.
facebooleanDraw the die outline (default true).
sizenumberDie square edge in viewBox units (default 16).

Plus the shared grammar — data, domain, color, title, summary, format — and the layout props (width, height, className, style) that every chart accepts. Interactive entries also share animate and live, and — wherever a chart has more than one navigable unit — onActive, onSelect, selectedIndex and defaultSelectedIndex; and — wherever the chart shows a hover value — readout. See the shared grammar.

Related charts