TrendBadge
Displays percentage change with an arrow and a tone color.
Props
TrendBadge extends HTMLAttributes<HTMLSpanElement>.
| Prop | Type | Default | Description |
|---|---|---|---|
delta | number | — | Signed percentage change. Sign picks the arrow direction. |
positiveIsGood | boolean | true | Whether an increase is good (revenue) or bad (error rate). |
format | (delta: number) => string | — | Formats the number. Default: +4.2%. |
label | string | — | Dim comparison label after the number (e.g. 'vs last week'). |
Examples
Positive (up)
+12.5%
Negative (down)
-5.3%
Flat (zero)
0.0%
Increase indicates an error
+8.1%
With label
import { TrendBadge } from "@solarius/onset";
import type { TrendBadgeProps } from "@solarius/onset";