#984
Trend tone
Three KPI cards where the trend colour follows what is good news: churn falling is green, response time rising is red, sessions are neutral.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Trend tone" pattern (@codeatlasdev/ui demo #984, layout/kpi-card) in my app.
Call get_demo({ ids: ["#984"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Metrics where down is good (churn, cost, latency) or where a change is not a judgement, with an accurate better/worse screen reader label.
Keep these library parts, with the props and tokens the demo uses:
- KpiCard, KpiGrid from "@codeatlasdev/ui"
Behaviour to keep:
- `<KpiGrid>` with 3 `KpiCard` items
- `<KpiCard title="Churn Rate" value="5.2" unit="%" trend={-1.8} trendTone="positive-down" icon={UserMinus} />`: a fall is green, announced "better"
- `<KpiCard title="Response Time" value="1.4" unit="s" trend={12.3} trendTone="positive-down" icon={Gauge} />`: a rise is red, announced "worse"
- `<KpiCard title="Sessions" value="3,847" trend={-2.1} trendTone="neutral" icon={Activity} />`: arrow only, no colour judgement
Reduced motion: the demo handles it; keep that branch.
Keyboard: not an interactive control.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
How it is built
- `<KpiGrid>` with 3 `KpiCard` items
- `<KpiCard title="Churn Rate" value="5.2" unit="%" trend={-1.8} trendTone="positive-down" icon={UserMinus} />`: a fall is green, announced "better"
- `<KpiCard title="Response Time" value="1.4" unit="s" trend={12.3} trendTone="positive-down" icon={Gauge} />`: a rise is red, announced "worse"
- `<KpiCard title="Sessions" value="3,847" trend={-2.1} trendTone="neutral" icon={Activity} />`: arrow only, no colour judgement
Related
Loading source.