Skip to content

Stats band

Headline numbers that count up in view, each with a tiny visual that proves it and a context line on hover, plain or in a hairline grid.

npx shadcn@latest add @silicon-ui/stats-band

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/stats-band

Manually

  1. Install the dependencies

    npm install motion
  2. Copy these files into your project

    • components/silicon-ui/blocks/stats-band/stats-band.tsx
    • components/silicon-ui/blocks/stats-band/stats-band-data.ts
    • components/silicon-ui/blocks/stats-band/stats-band.module.css
    • components/silicon-ui/blocks/stats-band/stats-band-world.ts

    Shared with other components. Skip any you already have.

    • components/silicon-ui/segmented-control/segmented-control.tsx
    • components/silicon-ui/segmented-control/segmented-control.module.css
    • components/silicon-ui/lib/fluid-hover.tsx
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { StatsBand } from "@/components/silicon-ui/blocks/stats-band/stats-band";

API reference

StatsBand

PropTypeDefault
stats

Three or four stats read best.

Stat[]exampleStats
layout

`plain` lets the stats float on whitespace; `divided` sets them in a hairline grid ruled above and below.

StatsBandLayout

"plain""divided"

"plain"
titlestring—
descriptionstring—
duration

Seconds each number takes to count up. Defaults to 1.6.

number1.6
locale

Number formatting locale. Fixed by default so server and client agree.

string"en-US"
classNamestring—

Also accepts the props of HTMLAttributes.

Dependencies

npm
motion
Registry
silicon-motion-tokenssegmented-control