Precise Number

Shows big numbers compactly (₹1.2 Cr, $1.2M) without ever rounding up, with the exact value one hover or focus away.

Stops₹1.24 Cr rounded up to ₹1.3 Cr

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/precise-number.json

The files land in your project. They're yours to edit.

Usage

precise-number-usage.tsx
import { PreciseNumber } from "@/components/ui/precise-number"

{ label: "Annual revenue", node: <PreciseNumber value={123456789} currency="INR" toggleable />

What it catches

  • ₹99,99,999 shown as ₹1 Cr: it reads ₹99.9 L instead
  • Exact value hidden: tooltip on hover or focus
  • Lakh/crore vs million confusion, with a toggle
  • Rounded percentages that overstate

Props

PreciseNumber props
PropTypeDefault
value* (required)

The exact value. For `percent`, a ratio (0.996 = 99.6%).

number—
format

Show a plain number or a percentage.

"number" | "percent""number"
currency

ISO currency code, e.g. "INR" or "USD".

string—
system

Lakh/crore or million/billion (controlled).

NumberSystem—
defaultSystem

Starting system when uncontrolled. Defaults to Indian for INR, international otherwise.

NumberSystem—
toggleable

Show a button that switches between the two systems.

booleanfalse
onSystemChange

Called when the toggle switches systems.

(system: NumberSystem) => void—
digits

Decimals shown: compact numbers default to 1 (truncated, never rounded up), percentages to 0.

number—
edge

For percentages: "<100%" (`bound`) or "99.6%" (`expand`) near 0% and 100%.

"bound" | "expand""expand"
exactLabel

Screen-reader prefix of the exact value in the tooltip.

string"Exactly"
toggleLabel

Accessible name of the system toggle; receives the system it switches to.

(next: NumberSystem) => string(next) => `Show in ${next === "international" ? "million …

* required. Also accepts the native props of <span> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Approximate values are focusable and described by the exact-value tooltip
  • Spoken units are given as text for screen readers
  • Toggle has an aria-label naming the system it switches to
  • Roll animation is skipped under reduced motion

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Display only; it doesn't parse input
  • Cutting means the compact figure can be slightly low; the tooltip is the exact value

What it stops

₹1.24 Cr rounded up to ₹1.3 Cr

Also known as

compact number · lakh · crore · number format · intl · tooltip · dashboard · ₹

Field type

Dependencies

Pairs well with