BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/motiq/kpi-number-morph

KPI Number Morph

motiq/kpi-number-morph
FreeComponent

An accessible KPI stat that smoothly morphs between values with a direction-aware trend (arrow + sign, never color alone). Controlled value; locale, compact, and currency formatting; loading and error states. Reduced-motion snaps.

Live preview

live · rendered by the registry
Rendered by motiq on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.motiq.dev/r/kpi-number-morph.json

Source

registry/data/kpi-number-morph.tsxwww.motiq.dev/r/kpi-number-morph.json · first 6 KB
1"use client";
2
3import * as React from "react";
4
5import { cn } from "@/lib/utils";
6import { formatNumber, useAnimatedNumber, useReducedMotion } from "@/lib/motiq";
7
8type KpiState = "idle" | "loading" | "error";
9
10export interface KpiNumberMorphProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "prefix"> {
11 /** Current metric value (controlled). */
12 value: number;
13 /** Metric name shown above the number. */
14 label?: string;
15 prefix?: string;
16 suffix?: string;
17 /** Fixed decimal places for the morphing number. */
18 decimals?: number;
19 /** "standard" | "compact" (12.4K, 3.1M). */
20 notation?: "standard" | "compact";
21 /** ISO currency code — renders the value as currency. */
22 currency?: string;
23 locale?: string;
24 /** Signed change (delta or percent); drives the direction-aware trend row. */
25 change?: number;
26 /** Text after the change, e.g. "vs last week". */
27 changeLabel?: string;
28 /** Render the change as a percentage (adds %, one decimal). */
29 changeAsPercent?: boolean;
30 state?: KpiState;
31 durationMs?: number;
32}
33
34function Trend({ dir }: { dir: "up" | "down" }) {
35 // Direction is conveyed by the glyph itself (not color alone) and stays
36 // visible under forced-colors.
37 return (
38 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden className="shrink-0">
39 {dir === "up" ? (
40 <path d="M12 19V5m0 0l-6 6m6-6l6 6" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" />
41 ) : (
42 <path d="M12 5v14m0 0l6-6m-6 6l-6-6" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" />
43 )}
44 </svg>
45 );
46}
47
48/**
49 * KpiNumberMorph — an accessible KPI stat that smoothly morphs between values
50 * with a clear, direction-aware trend indicator.
51 *
52 * Accessibility: change direction is carried by an arrow glyph AND a sign in the
53 * text — never by color alone; the tile exposes a combined `aria-label`
54 * (label + value + change) and does not spam a live region. Loading uses
55 * `aria-busy`. Under `prefers-reduced-motion` the number snaps instead of
56 * counting. Clean-room original.
57 */
58export function KpiNumberMorph({
59 value,
60 label,
61 prefix,
62 suffix,
63 decimals = 0,
64 notation = "standard",
65 currency,
66 locale,
67 change,
68 changeLabel,
69 changeAsPercent = false,
70 state = "idle",
71 durationMs = 750,
72 className,
73 ...rest
74}: KpiNumberMorphProps) {
75 const reduce = useReducedMotion();
76 const animate = state === "idle";
77// … truncated

What it pulls in

Other registry items

  • https://motiq.dev/r/utils.json
  • https://motiq.dev/r/primitives.json

Files it writes

  • registry/data/kpi-number-morph.tsx

Facts

Registry
motiq
Type
registry:component
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-12
Last confirmed
yesterday

Go to the source

Docs on motiq www.motiq.dev RMahammad/motiq on GitHub Raw registry item This item as JSON

More from motiq

All 100 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Activity Streamactivity-streammotiqComponentsFree1 dep
Adaptive Safe-Zone Gridadaptive-safe-zone-gridmotiqComponentsFreeno deps
Agent Run Timelineagent-run-timelinemotiqComponentsFree1 dep
AI Response Streamai-response-streammotiqComponentsFree1 dep
Animated Accordionanimated-accordionmotiqComponentsFree2 deps
Animated Buttonanimated-buttonmotiqComponentsFree1 dep
Animated Dialoganimated-dialogmotiqComponentsFree2 deps
Animated Gridanimated-gridmotiqComponentsFree2 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

KitGrade

SaaS starter kits, scored from measured facts

kitgrade.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex