Staaarter

Trend Arrow Stats

Grid of stat tiles, each showing a value and a small trend indicator, an arrow icon plus a delta figure, driven by a per-stat direction prop. Up and down trends are distinguished with tone (text-primary vs text-muted-foreground), not literal red/green colors.

By Staaarter Team
Stats
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/trend-arrow-stats.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/stats/stats11.tsx instead.

Usage

The file also exports stats11Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Stats11, stats11Demo } from "@/components/blocks/stats/stats11";

export default function Page() {
  return <Stats11 {...stats11Demo} />;
}

Props

PropTypeDefaultDescription
badge{ label: string; variant?: BadgeVariant }nonePill above the heading; only rendered when badge is truthy.
headingstringundefinedSection heading.
descriptionstringundefinedSection intro text.
statsTrendStat[]noneStat tiles, each carrying its own trend direction and delta.
classNamestringnoneExtra classes for the outer section element.

Types

type TrendStat = {
  label: string;
  value: string;
  delta: string;
  direction: "up" | "down";
};

Behavior notes

  • The arrow icon and text tone are chosen purely from each item's direction prop ("up" renders ArrowUp in text-primary, "down" renders ArrowDown in text-muted-foreground); this is a static mapping evaluated at render time, not a live computation from the value or delta.
  • direction is descriptive metadata supplied by the caller, it does not imply whether the change is good or bad for the metric in question (e.g. a falling churn rate is still rendered with direction: "down").
  • No literal red/green colors are used anywhere; tone is conveyed with semantic tokens only.