Skip to content
Browse components

GrowthCard

One figure, its change since the last period, and recent periods as bars. Pass several metrics and it steps through them.

Revenue
since last week

Installation

Run this in a project that has a components.json. It adds one file, components/tenor-ui/growth-card.tsx, and no packages.

pnpm dlx shadcn@latest add https://tenor.design/r/growth-card.json

No components.json? Fetch the file. It works in any React project.

curl --create-dirs -o src/components/tenor-ui/growth-card.tsx https://tenor.design/r/growth-card.tsx

Usage

Every prop is optional. With none, it renders the content you see above.

<GrowthCard />
import { GrowthCard } from "@/components/tenor-ui/growth-card"; export function WeeklyRevenue() { return ( <GrowthCard metrics={[ { label: "Revenue", value: 84210, change: 24, bars: [34, 45, 58, 74, 100] }, { label: "Costs", value: 32640, change: -12, bars: [100, 88, 79, 71, 63] }, ]} unit="USD" caption="since last week" /> ); }

Props

PropTypeDefaultWhat it does
metricsreadonly GrowthCardMetric[]growthCardMetricsMetrics to show. More than one makes the card step through them.
unitstring"USD"Unit shown after the figure.
captionstring"since last week"Line under the change.
intervalnumber4800Milliseconds each metric stays up before the next. 0 keeps the first metric.
localestring"en-US"Locale used to format the figure.

It also takes every attribute of its root element, such as className and style.

Theming

Set any of these CSS variables on the component or on an ancestor. Each falls back to the look shown here.

  • --tui-surface
  • --tui-stroke
  • --tui-text
  • --tui-muted
  • --tui-bar-from
  • --tui-bar-to
  • --tui-font-sans
  • --tui-font-mono