BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/tool-ui/stats-display

Stats Display

tool-ui/stats-display
FreeBlock

Display key metrics in compact cards.

See it running

Open the demo on tool-ui

www.tool-ui.com/components/stats-display
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://www.tool-ui.com/r/stats-display.json

Source

components/tool-ui/stats-display/stats-display.tsxwww.tool-ui.com/r/stats-display.json · first 6 KB
1"use client";
2import {
3 cn,
4 Card,
5 CardHeader,
6 CardTitle,
7 CardDescription,
8 CardContent,
9} from "./_adapter";
10import type {
11 StatsDisplayProps,
12 StatItem,
13 StatFormat,
14 StatDiff,
15} from "./schema";
16import { Sparkline } from "./sparkline";
17
18interface FormattedValueProps {
19 value: string | number;
20 format?: StatFormat;
21 locale?: string;
22}
23
24function FormattedValue({ value, format, locale }: FormattedValueProps) {
25 if (typeof value === "string" || !format) {
26 return <span className="font-light tabular-nums">{String(value)}</span>;
27 }
28
29 switch (format.kind) {
30 case "number": {
31 const decimals = format.decimals ?? 0;
32 if (format.compact) {
33 const parts = new Intl.NumberFormat(locale, {
34 minimumFractionDigits: decimals,
35 maximumFractionDigits: decimals,
36 notation: "compact",
37 }).formatToParts(value);
38 const fullNumber = new Intl.NumberFormat(locale).format(value);
39 return (
40 <span className="font-light tabular-nums" aria-label={fullNumber}>
41 {parts.map((part, i) =>
42 part.type === "compact" ? (
43 <span
44 key={i}
45 className="ml-0.5 text-[0.65em] opacity-80"
46 aria-hidden="true"
47 >
48 {part.value}
49 </span>
50 ) : (
51 <span key={i}>{part.value}</span>
52 ),
53 )}
54 </span>
55 );
56 }
57 const formatted = new Intl.NumberFormat(locale, {
58 minimumFractionDigits: decimals,
59 maximumFractionDigits: decimals,
60 }).format(value);
61 return <span className="font-light tabular-nums">{formatted}</span>;
62 }
63 case "currency": {
64 const currency = format.currency;
65 const decimals = format.decimals ?? 2;
66 const formatted = new Intl.NumberFormat(locale, {
67 style: "currency",
68 currency,
69 minimumFractionDigits: decimals,
70 maximumFractionDigits: decimals,
71 }).format(value);
72 const spokenValue = new Intl.NumberFormat(locale, {
73 style: "currency",
74 currency,
75 currencyDisplay: "name",
76 minimumFractionDigits: decimals,
77 maximumFractionDigits: decimals,
78 }).format(value);
79 return (
80 <span className="font-light tabular-nums" aria-label={spokenValue}>
81 {formatted}
82 </span>
83 );
84 }
85 case "percent": {
86 const decimals = format.decimals ?? 2;
87// … truncated

What it pulls in

npm packages

  • zod

Other registry items

  • card

Files it writes

  • components/tool-ui/shared/contract.ts
  • components/tool-ui/shared/parse.ts
  • components/tool-ui/shared/schema.ts
  • components/tool-ui/stats-display/_adapter.tsx
  • components/tool-ui/stats-display/index.tsx
  • components/tool-ui/stats-display/README.md
  • components/tool-ui/stats-display/schema.ts
  • components/tool-ui/stats-display/sparkline.tsx
  • components/tool-ui/stats-display/stats-display.tsx

Facts

Registry
tool-ui
Type
registry:block
Access
Free
Files written
9
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on tool-ui www.tool-ui.com Raw registry item This item as JSON

More from tool-ui

All 27 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Approval Cardapproval-cardtool-uiBlocksFree2 deps · 11 files
Audioaudiotool-uiBlocksFree2 deps · 9 files
Chartcharttool-uiBlocksFree2 deps · 8 files
Citationcitationtool-uiBlocksFree2 deps · 15 files
Code Blockcode-blocktool-uiBlocksFree3 deps · 11 files
Code Diffcode-difftool-uiBlocksFree3 deps · 10 files
Data Tabledata-tabletool-uiBlocksFree1 dep · 17 files
Geo Mapgeo-maptool-uiBlocksFree4 deps · 12 files
BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex