Components
Trend
A change, like +12% with an arrow, coloured by whether it is good news.
Spent$1,845+12%vs last month
Saved$640+8.4%vs last month
Bills$1,2100%vs last month
Import
import { Trend } from '@rinzai/zen';API reference
<Trend>
A change, e.g. "+12%" with an arrow, coloured by whether it's good news: savings going up is, spending going up isn't (good="down"). value is the change as a fraction (0.12 for 12%); children follow it, muted, e.g. "vs last month".
| Prop | Type | Default |
|---|---|---|
valueRequiredThe change as a fraction: 0.12 is 12% up, -0.05 is 5% down. | number | — |
formatHow the change reads, e.g. as money instead of a percent. | ((value: number) => string) | (v) =>
new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: 1, signDisplay: 'exceptZero' }).format(
v,
) |
goodWhich way is good news (default | "down" | "up" | up |
localeFor the default percent format. | string | — |