Data

Dot Grid

An activity grid of dots that grow on springs to their level, with changes sweeping across in a diagonal wave.

Preview

Installation

Terminal
npx @usefluid/cli add dot-grid

Usage

DotGrid.tsx
import { DotGrid } from "./DotGrid";

<DotGrid label="Commits" values={dailyCounts} summary="16 weeks of activity" />

API reference

PropTypeDefaultDescription
labelstring—What the grid shows. Shown under it and used as the accessible name.
valuesnumber[]—One value per dot, filled column by column. Each becomes one of five levels against the max.
maxnumberthe largest valueThe value of the fullest dot.
rowsnumber7Dots per column: 7 for days of the week.
summarystring—A sentence for screen readers, such as the total or the busiest day.
colorstring`--fluid-accent`The colour of the fullest dot; the other levels mix it with the surface.

Keyboard and screen readers

The grid is an image named with the label and the summary, because hundreds of dots are not useful one by one. With reduced motion dots change at once.

Notes

levelOf in grid.ts maps a value to a level from 0 to 4. Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

Each value becomes one of five levels, and each dot grows to its level on a spring that is slower the further it is from the corner, so a change sweeps across the grid as a wave. The levels mix your colour with the surface. Screen readers get one sentence for the whole grid.

For your agent

For your agent

Add Dot Grid to my project with the Fluid library. Use DotGrid for the activity of my product, one dot per day, with a summary sentence. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.