Skip to content

Metric card

A compact summary for a number that needs context.

DataSummary
npx shadcn@latest add @silicon-ui/metric-card

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/metric-card

Manually

  1. Install the dependencies

    npm install motion
  2. Copy these files into your project

    • components/silicon-ui/metric-card/metric-card.tsx
    • components/silicon-ui/metric-card/metric-card.module.css

    Shared with other components. Skip any you already have.

    • components/silicon-ui/animated-counter/animated-counter.tsx
    • components/silicon-ui/animated-counter/animated-counter.module.css
  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 { MetricCard } from "@/components/silicon-ui/metric-card/metric-card";

API reference

PropTypeDefault
label*string—
value*number—
context*string—
suffixstring—
changestring—

Dependencies

npm
motion
Registry
silicon-motion-tokensanimated-counter