Weekly Installs Card
KPI stats card for weekly installs and growth: a large total, a hairline recharts sparkline over eight weeks with only the latest point highlighted, and a change caption. Recharts is pinned to 3.8.0.
- Section
- Metrics
- Built from
- 4 parts
- Files
- 1 file
- Added
- Sep 16, 2026
pnpm dlx shadcn add @01orbital/app-stats"use client"
import { Line, LineChart } from "recharts"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { ChartContainer, type ChartConfig } from "@/components/ui/chart"
import { Separator } from "@/components/ui/separator"
// The copy: change text here, not in the markup.
const COPY = {
title: "Installs",
body: "Components added to projects, week by week.",
unit: "this month",
window: "Last 8 weeks",
change: "+20.1% on last month",
} as const
const VALUE = 48120
const data = [
{ installs: 10400 },
{ installs: 14405 },
{ installs: 9400 },
{ installs: 8200 },
{ installs: 7000 },
{ installs: 9600 },
{ installs: 11244 },
{ installs: 26475 },
]
const chartConfig = {
installs: { label: "Installs" },
} satisfies ChartConfig
// The line is a hairline; only the latest week takes the accent.
function LatestDot(props: { cx?: number; cy?: number; index?: number }) {
if (props.index !== data.length - 1) return null
return <circle cx={props.cx} cy={props.cy} r={3} fill="var(--art-accent)" />
}
export default function AppStats() {
return (
<Card className="mx-auto w-full max-w-sm gap-8">
<CardHeader>
<CardTitle>{COPY.title}</CardTitle>
<CardDescription>{COPY.body}</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-8">
<span className="flex items-baseline gap-2">
<span className="text-3xl font-medium tabular-nums">
{VALUE.toLocaleString("en-US")}
</span>
<Eyebrow variant="mono" render={<span />}>
{COPY.unit}
</Eyebrow>
</span>
<figure className="flex flex-col gap-3">
<ChartContainer config={chartConfig} className="h-28 w-full">
<LineChart
data={data}
margin={{ top: 6, right: 6, left: 6, bottom: 6 }}
>
<Line
type="monotone"
dataKey="installs"
stroke="var(--muted-foreground)"
strokeWidth={1.5}
dot={<LatestDot />}
activeDot={false}
isAnimationActive={false}
/>
</LineChart>
</ChartContainer>
<Separator />
<figcaption className="flex items-baseline justify-between">
<Eyebrow variant="mono" render={<span />}>
{COPY.window}
</Eyebrow>
<span className="text-sm/7 tabular-nums">{COPY.change}</span>
</figcaption>
</figure>
</CardContent>
</Card>
)
}
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
Make it yours
- Its words are in
COPYat the top ofcomponents/blocks/app/stats/index.tsx: change them there, not in the markup. VALUE, also at the top of the file, holds its lists and settings.
Built from
npm: recharts@3.8.0. The CLI installs them for you.
The parts it installs with it: