Tally

Animated Dot Chart for React

A chart where every dot is a fixed amount (a job, a vote, a hundred dollars), packed into one round cluster per category. When the numbers change, the dots that moved fly from the clusters that shrank to the ones that grew on hairline trails, and the counts underneath step as they land. Units you mark hollow, like retries, sit among the dots as rings.

  • Chart
  • Data
  • Canvas

Uses clsx, tailwind-merge

Open in ChatGPTOpen in Claude
layout
dotSize6.0px
gap1.5px
trailstrue
duration1.10s(replays the demo)
stagger0.90s(replays the demo)
trailLength0.55(replays the demo)
legendtrue
<Tally />

replays the demo when you let go.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Tally: A chart where every dot is a fixed amount (a job, a vote, a hundred dollars), packed into one round cluster per category. When the numbers change, the dots that moved fly from the clusters that shrank to the ones that grew on hairline trails, and the counts underneath step as they land. Units you mark hollow, like retries, sit among the dots as rings.
This demo, Failover: Jobs by region for an inference platform. Take eu-west offline and its jobs fly to the other three regions, while retries show up as rings.

1. Install it:
   npx shadcn@latest add @keyframeui/tally-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/tally-demo.json instead.)
   It adds the demo, components/tally-demo.tsx, and the component, components/ui/tally.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <Tally> on its own.

3. These props set its feel. Change them before you change the file:
   - layout (default "row"): `row` sets the clusters side by side over one line of labels, wrapping onto more rows when columns would get narrower than about 130px. `free` puts each cluster at its item's `x` and `y`, like places on a map, with its label under it.
   - dotSize (default 6): Diameter of a dot, in px. When a cluster would outgrow its room, every dot shrinks together instead, so the clusters stay comparable.
   - gap (default 1.5): Space between neighbouring dots, in px.
   - trails (default true): Draw each dot's path behind it as a hairline that reels in once it lands.
   - duration (default 1.1): Seconds a dot takes to fly: in from the edge, or across to another cluster. Each one varies by a quarter either way.
   - stagger (default 0.9): Seconds between the first dot leaving the edge and the last, on the way in.
   - trailLength (default 0.55): How far a trail lags behind its dot, as a share of the flight, from 0 (none) to 1 (the whole path so far).
   - legend (default true): Show the legend above the clusters: what one dot is worth, and what a ring means. It takes a 28px band at the top.

4. Don't change, in components/ui/tally.tsx:
   - Every dot's position is a closed-form function of time (a cubic from where it was to its slot), so it lands exactly, a new update starts from where each dot is, and the loop stops once nothing moves.
   - A cluster fills its hex spiral from the middle out, so it grows and shrinks at its rim and stays round; a shrinking cluster hands its outermost dots to the nearest growing cluster first.
   - Dots keep their identity and `per` stays fixed once picked: a unit that moved between categories flies between clusters and is never swapped for a new dot. Only a change in the total brings dots in from the edge or sends them out through it.
   - Each cluster draws in its item's color, read from a swatch beside its label, and a dot crossing to another cluster shades from the old color to the new one as it flies.
   - Under reduced motion nothing flies: the chart crossfades to the new numbers and counts jump.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/tally.md

Installation

Add the component on its own with the CLI, or copy the file in by hand.

The CLI writes components/ui/tally.tsx and installs clsx and tailwind-merge. It needs the @keyframeui registry in components.json; add it once per project.

npx shadcn@latest add @keyframeui/tally

Examples

Finished sections built with Tally. Each one installs whole, with the component included.

Live Poll

A naming poll where every vote is a dot that flies in from the edge as it's cast, yours included.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Tally: A chart where every dot is a fixed amount (a job, a vote, a hundred dollars), packed into one round cluster per category. When the numbers change, the dots that moved fly from the clusters that shrank to the ones that grew on hairline trails, and the counts underneath step as they land. Units you mark hollow, like retries, sit among the dots as rings.
This demo, Live Poll: A naming poll where every vote is a dot that flies in from the edge as it's cast, yours included.

1. Install it:
   npx shadcn@latest add @keyframeui/tally-poll-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/tally-poll-demo.json instead.)
   It adds the demo, components/tally-poll-demo.tsx, and the component, components/ui/tally.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <Tally> on its own.

3. These props set its feel. Change them before you change the file:
   - layout (default "row"): `row` sets the clusters side by side over one line of labels, wrapping onto more rows when columns would get narrower than about 130px. `free` puts each cluster at its item's `x` and `y`, like places on a map, with its label under it.
   - dotSize (default 6): Diameter of a dot, in px. When a cluster would outgrow its room, every dot shrinks together instead, so the clusters stay comparable.
   - gap (default 1.5): Space between neighbouring dots, in px.
   - trails (default true): Draw each dot's path behind it as a hairline that reels in once it lands.
   - duration (default 1.1): Seconds a dot takes to fly: in from the edge, or across to another cluster. Each one varies by a quarter either way.
   - stagger (default 0.9): Seconds between the first dot leaving the edge and the last, on the way in.
   - trailLength (default 0.55): How far a trail lags behind its dot, as a share of the flight, from 0 (none) to 1 (the whole path so far).
   - legend (default true): Show the legend above the clusters: what one dot is worth, and what a ring means. It takes a 28px band at the top.

4. Don't change, in components/ui/tally.tsx:
   - Every dot's position is a closed-form function of time (a cubic from where it was to its slot), so it lands exactly, a new update starts from where each dot is, and the loop stops once nothing moves.
   - A cluster fills its hex spiral from the middle out, so it grows and shrinks at its rim and stays round; a shrinking cluster hands its outermost dots to the nearest growing cluster first.
   - Dots keep their identity and `per` stays fixed once picked: a unit that moved between categories flies between clusters and is never swapped for a new dot. Only a change in the total brings dots in from the edge or sends them out through it.
   - Each cluster draws in its item's color, read from a swatch beside its label, and a dot crossing to another cluster shades from the old color to the new one as it flies.
   - Under reduced motion nothing flies: the chart crossfades to the new numbers and counts jump.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/tally.md

Budget Split

One monthly ad budget split three ways. Switching plans moves the dollars between channels instead of redrawing the chart.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Tally: A chart where every dot is a fixed amount (a job, a vote, a hundred dollars), packed into one round cluster per category. When the numbers change, the dots that moved fly from the clusters that shrank to the ones that grew on hairline trails, and the counts underneath step as they land. Units you mark hollow, like retries, sit among the dots as rings.
This demo, Budget Split: One monthly ad budget split three ways. Switching plans moves the dollars between channels instead of redrawing the chart.

1. Install it:
   npx shadcn@latest add @keyframeui/tally-budget-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/tally-budget-demo.json instead.)
   It adds the demo, components/tally-budget-demo.tsx, and the component, components/ui/tally.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <Tally> on its own.

3. These props set its feel. Change them before you change the file:
   - layout (default "row"): `row` sets the clusters side by side over one line of labels, wrapping onto more rows when columns would get narrower than about 130px. `free` puts each cluster at its item's `x` and `y`, like places on a map, with its label under it.
   - dotSize (default 6): Diameter of a dot, in px. When a cluster would outgrow its room, every dot shrinks together instead, so the clusters stay comparable.
   - gap (default 1.5): Space between neighbouring dots, in px.
   - trails (default true): Draw each dot's path behind it as a hairline that reels in once it lands.
   - duration (default 1.1): Seconds a dot takes to fly: in from the edge, or across to another cluster. Each one varies by a quarter either way.
   - stagger (default 0.9): Seconds between the first dot leaving the edge and the last, on the way in.
   - trailLength (default 0.55): How far a trail lags behind its dot, as a share of the flight, from 0 (none) to 1 (the whole path so far).
   - legend (default true): Show the legend above the clusters: what one dot is worth, and what a ring means. It takes a 28px band at the top.

4. Don't change, in components/ui/tally.tsx:
   - Every dot's position is a closed-form function of time (a cubic from where it was to its slot), so it lands exactly, a new update starts from where each dot is, and the loop stops once nothing moves.
   - A cluster fills its hex spiral from the middle out, so it grows and shrinks at its rim and stays round; a shrinking cluster hands its outermost dots to the nearest growing cluster first.
   - Dots keep their identity and `per` stays fixed once picked: a unit that moved between categories flies between clusters and is never swapped for a new dot. Only a change in the total brings dots in from the edge or sends them out through it.
   - Each cluster draws in its item's color, read from a swatch beside its label, and a dot crossing to another cluster shades from the old color to the new one as it flies.
   - Under reduced motion nothing flies: the chart crossfades to the new numbers and counts jump.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/tally.md

Props

items Required

TypeTallyItem[]

The categories, in order: { id, label, value, hollow?, x?, y?, dotClassName? }. A cluster holds value / per dots, rounded, and hollow of that amount is drawn as rings (failed, refunded, retried). Keep each id stable: change a value and the dots that moved fly between clusters, shading from the old cluster's color to the new one's; a bigger total brings dots in from the edge and a smaller one sends them out. x and y (0–1) place the cluster when layout is "free". dotClassName is the cluster's own text-* color (dots, rings and the swatch by its label, dark: variants included); without it, clusters take a vivid palette in order: orange, violet, green, pink, blue, amber.

per

Typenumber

How much one dot stands for. Without it, it's picked on first layout (about 600 dots in all, rounded to 1, 2, 2.5 or 5 × 10ⁿ, with room for each cluster to grow) and then kept, so a dot means the same amount after every update.

layout

Type"row" | "free"Default"row"

row sets the clusters side by side over one line of labels, wrapping onto more rows when columns would get narrower than about 130px. free puts each cluster at its item's x and y, like places on a map, with its label under it.

dotSize

TypenumberDefault6

Diameter of a dot, in px. When a cluster would outgrow its room, every dot shrinks together instead, so the clusters stay comparable.

gap

TypenumberDefault1.5

Space between neighbouring dots, in px.

trails

TypebooleanDefaulttrue

Draw each dot's path behind it as a hairline that reels in once it lands.

duration

TypenumberDefault1.1

Seconds a dot takes to fly: in from the edge, or across to another cluster. Each one varies by a quarter either way.

stagger

TypenumberDefault0.9

Seconds between the first dot leaving the edge and the last, on the way in.

trailLength

TypenumberDefault0.55

How far a trail lags behind its dot, as a share of the flight, from 0 (none) to 1 (the whole path so far).

format

Type(value: number) => string

Formats the counts under the clusters and the legend's amount. Defaults to grouped digits (4,800).

unit

Typestring

What one unit is called ("jobs", "votes"), after the amount in the legend and for screen readers.

hollowLabel

Typestring

What a hollow ring means ("retried"). Adds a ring to the legend with it.

legend

TypebooleanDefaulttrue

Show the legend above the clusters: what one dot is worth, and what a ring means. It takes a 28px band at the top.

label

Typestring

Names the chart for screen readers. They read a list of every item and its value, announced again when the numbers change.

dotClassName

Typestring

One text-* color for every cluster, for a one-color chart; it also colors the legend's marks. An item's own dotClassName still wins. Without either, each cluster takes the next color of the built-in palette. The canvas reads it, so dark: variants work.

labelClassName

Typestring

Classes for each label under a cluster. Its color sets the count's; the category name draws at 60% of it.

onSettle

Type() => void

Called each time every dot has landed: after the entrance and after each update.

children

TypeReact.ReactNode

Content drawn over the chart.

className

Typestring

Classes for the box. Give it a height: clusters fill it above a 46px band of labels per row, and pointing at a cluster or its label dims the rest.