Stats Card
Stats card for dashboards displaying KPIs with trend deltas, an info tooltip, an icon, a progress bar, and an accent bar.
import { StatsCard } from "@plexui/ui/components/StatsCard";Formerly StatCard. The old name and its import path @plexui/ui/components/StatCard still work but are deprecated.
Examples
Overview
size
variant
trendPosition
trendVariant
Total Revenue
$45,231
+12.5%
vs last monthAPI
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Required. Label describing the metric |
value | ReactNode | — | Required. The primary metric value |
description | string | — | Subtitle below the value |
trend | { value: number; label?: string } | — | Trend indicator with percentage |
invertTrend | boolean | false | Invert trend colors (positive = bad) |
trendPosition | "value" | "header" | "value" | Where the trend indicator is rendered |
trendVariant | "text" | "badge" | "text" | Render trend as text or badge |
size | "default" | "sm" | "default" | Card size. Use sm for compact analytics layouts |
icon | ReactNode | — | Icon in a small soft tile at the end of the header |
sparkline | ReactNode | — | Chart rendered at the bottom |
progress | number | — | Progress bar value (0-100) |
progressLabel | string | — | Label after the progress bar |
tooltip | string | — | Shows an info icon next to the label with tooltip text |
variant | "default" | "accent" | "default" | Visual variant |
accentColor | "primary" | "secondary" | "danger" | "info" | "discovery" | "success" | "caution" | "warning" | "primary" | Color of the accent bar (accent variant) |
className | string | — | Extra classes on the card element |
Styling
Stats Card reads these component tokens. Override them at any scope to restyle it:
--stats-card-accent-width: accent width (default4px)--stats-card-background: background (defaultvar(--color-surface))--stats-card-border-color: border color (defaultvar(--color-border))--stats-card-description-color: description color (defaultvar(--color-text-tertiary))--stats-card-description-font-size: description font size (defaultvar(--font-text-sm-size))--stats-card-icon-color: icon color (defaultvar(--color-text-primary))--stats-card-icon-size: icon size (default16px)--stats-card-icon-wrapper-background: icon wrapper background (defaultvar(--color-background-primary-soft-alpha))--stats-card-icon-wrapper-radius: icon wrapper radius (defaultvar(--radius-md))--stats-card-icon-wrapper-size: icon wrapper size (default32px)--stats-card-info-icon-size: info icon size (default16px)--stats-card-label-color: label color (defaultvar(--color-text-secondary))--stats-card-label-font-size: label font size (defaultvar(--font-text-sm-size))--stats-card-padding: padding (defaultspacing(5))--stats-card-progress-background: progress background (defaultlight-dark(var(--alpha-08), var(--alpha-12)))--stats-card-progress-fill: progress fill (defaultvar(--color-background-primary-solid))--stats-card-progress-height: progress height (default4px)--stats-card-progress-radius: progress radius (defaultvar(--radius-full))--stats-card-radius: radius (defaultvar(--radius-xl))--stats-card-sm-description-font-size: sm description font size (defaultvar(--font-text-xs-size))--stats-card-sm-icon-size: sm icon size (default14px)--stats-card-sm-icon-wrapper-radius: sm icon wrapper radius (defaultvar(--radius-sm))--stats-card-sm-icon-wrapper-size: sm icon wrapper size (default28px)--stats-card-sm-info-icon-size: sm info icon size (default14px)--stats-card-sm-label-font-size: sm label font size (defaultvar(--font-text-xs-size))--stats-card-sm-padding-block: sm padding block (defaultspacing(3))--stats-card-sm-padding-inline: sm padding inline (defaultspacing(4))--stats-card-sm-trend-font-size: sm trend font size (defaultvar(--font-text-xs-size))--stats-card-sm-value-font-size: sm value font size (defaultvar(--font-heading-md-size))--stats-card-trend-font-size: trend font size (defaultvar(--font-text-sm-size))--stats-card-trend-font-weight: trend font weight (defaultvar(--font-weight-semibold))--stats-card-trend-negative-color: trend negative color (defaultvar(--color-text-danger-soft))--stats-card-trend-neutral-color: trend neutral color (defaultvar(--color-text-tertiary))--stats-card-trend-positive-color: trend positive color (defaultvar(--color-text-success-soft))--stats-card-value-color: value color (defaultvar(--color-text))--stats-card-value-font-size: value font size (defaultvar(--font-heading-xl-size))--stats-card-value-font-weight: value font weight (defaultvar(--font-weight-semibold))