Skip to content
caliper ui docs

Components

Tally count

A count kept as tally marks. Four strokes and a slash across them make a gate of five; gates line up and wrap. Each mark is drawn in as the count rises and drawn back as it falls.

Free
pnpm dlx shadcn@latest add @caliper/tally-count

Site safety

Days without an incident.

13 days
Installs components/ui/tally-count.tsxDepends on none beyond ReactMotion none in component source

When to use

Use it for

  • Days without an incident, wins, streaks and small running totals.
  • Counts where the pile itself is the point.

Skip it when

  • Counts into the hundreds; use `AnimatedCounter`.
  • Values that need a precise readout beside them.

Decisions

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

Each mark is a drawn path
Marks use dash offsets, so they draw in the direction a pen would, and the slash follows the fourth stroke.

Usage

Named for what is counted
It is an image labelled with the number and what was counted, so the total is read as text.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/tally-count

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

This is the code behind the preview above.

example.tsx
import { useState, type ReactNode } from "react"
import { Button } from "@/components/ui/button"
import { TallyCount } from "@/components/ui/tally-count"

function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) {
  return (
    <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting max-sm:p-4 ${className}`}>
      <div className="grid gap-1">
        <p className="font-medium">{title}</p>
        <p className="text-sm text-muted-foreground">{context}</p>
      </div>
      {children}
    </section>
  );
}

export function TallyCountDemo() {
  const [count, setCount] = useState(13);
  return (
    <Panel title="Site safety" context="Days without an incident.">
      <TallyCount count={count} label="days without an incident" />
      <div className="flex flex-wrap items-center gap-2 border-t border-border pt-4">
        <span className="flex-1 text-sm text-muted-foreground tabular-nums">{count} days</span>
        <Button variant="secondary" size="sm" onClick={() => setCount((value) => value + 1)}>
          Add a day
        </Button>
        <Button variant="secondary" size="sm" onClick={() => setCount((value) => value + 5)}>
          Add 5
        </Button>
        <Button variant="ghost" size="sm" onClick={() => setCount(0)}>
          Reset
        </Button>
      </div>
    </Panel>
  );
}

API reference

TallyCount

component

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
count *number—
labelstring"counted"Names what is counted, e.g. "days without an incident".

Accessibility

It exposes img semantics, with aria-label and aria-hidden kept in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Changing values examples