npx shadcn@latest add https://sdk-components.thesqd.com/r/stat.json https://sdk-components.thesqd.com/r/chart.jsonhttps://sdk-components.thesqd.com/cdn/charts-cdn.htmlimport { Stat } from "@/components/ui/stat";import { Stat } from "@/components/ui/stat";
export function Example() {
return (
<Stat
className="max-w-sm"
label="Revenue"
value="$48,210"
delta={{ direction: "up", value: "+12.4%" }}
/>
);
}Stat
├── StatHeader (optional — flex row for label + badge)
│ ├── StatLabel
│ └── StatBadge
├── StatValue
├── StatDelta (direction: "up" | "down" | "flat")
└── StatDescriptionStat
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "ghost" | "default" | `ghost` strips the border + background so the Stat blends into a parent surface. |
highlight | boolean | — | Paints the StatValue in coral to flag attention-worthy metrics (e.g. churn). |
label | ReactNode | — | Top label. When set (with no `children`), Stat auto-renders `<StatHeader><StatLabel/>…</StatHeader>`. |
value | ReactNode | — | Headline value. Flat-prop mode auto-renders `<StatValue>`. |
delta | { direction: "up" | "down" | "flat"; value: ReactNode } | — | Auto-renders `<StatDelta>` after the value. |
description | ReactNode | — | Muted description rendered after value/delta. |
badge | ReactNode | — | Small pill rendered in the header next to the label (auto-renders `<StatBadge>`). |
action | AnimatedArrowLinkProps | ReactNode | — | Right-aligned header action. Pass `{ href, label?, animated?, ariaLabel?, target? }` to auto-render an `<AnimatedArrowLink>`; pass any other ReactNode to drop in a custom control. |
className | string | — | Override or extend the resolved Stat classes. |
StatDelta
| Prop | Type | Default | Description |
|---|---|---|---|
direction | "up" | "down" | "flat" | "flat" | Drives the icon and tone of the delta pill (emerald / red / muted). |
value | ReactNode | — | Already-formatted delta text (e.g. `+12.4%`). Use a NumberFormat upstream. |
AnimatedArrowLink
| Prop | Type | Default | Description |
|---|---|---|---|
href | string | — | Destination URL. |
label | string | — | Visible link text. Omit (or pass empty string) to render an icon-only button — `ariaLabel` becomes required. |
animated | boolean | true | Use the animated `ArrowUpRightIcon`. Pass `false` for the static lucide `ArrowUpRight` glyph. |
target | "_blank" | "_self" | "_parent" | "_top" | "_blank" | `_blank` adds `rel="noopener noreferrer"` automatically. Pass `_self` to navigate in place. |
ariaLabel | string | — | Required when `label` is omitted. |
iconSize | number | 16 with label, 18 icon-only | Override the px size of the arrow glyph. |
className | string | — | Override or extend resolved Button classes. |