Skip to content
synccn

Stat Card

KPI tile with change and a sparkline.

Revenue

$48,290

+12.4% vs last month

Active users

3,912

-2.1% vs last month

Installation

$ pnpm dlx shadcn@latest add @synccn/stat-card

First time in this project? Connect synccn with one command.

Usage

import { StatCard } from "@/components/ui/stat-card";<StatCard label="Revenue" value="$48,290" change={12.4} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

StatCard

KPI tile: label, value, change since last period and a trend line.

  • labelrequired
    React.ReactNode

    What the number measures.

  • valuerequired
    React.ReactNode

    Formatted value.

  • change
    number

    Percentage change since last period.

  • changeLabel
    string

    Default "vs last month"

    What the change is measured against.

  • goodWhen
    "up" | "down"

    Default "up"

    Whether a rise is good news (revenue) or bad news (error rate, latency). Sets the colour.

  • trend
    number[]

    Values for the sparkline.

  • icon
    React.ElementType

    Icon in the corner.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Components

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

No ARIA roles, key handling or motion settings in its source. It renders plain elements, so its accessibility comes from the content and labels you give it.