React Native · Components
Stat
Metric (KPI) card for dashboards: name, large value, change vs the previous period, description and trend chart.
6 exports
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
Monthly revenue
$0
12.4% increasevs last monthCode
Events
- Events appear here when you interact with the preview.
Dashboard grid
Revenue
$48,230
12.4% increaseNew members
1,284
2% decreasethis weekError rate
1.2%
18% decreaseTarget: below 1%
Response time
182ms
No changeImport
Stat
componentMetric (KPI) card for dashboards: name, large value, change vs the previous period, description and trend chart. Calculations and formatting are the same as the web Stat; screen readers read the change as e.g. "12.5% increase".
Examples
statChange
functionComputes the change ratio and direction.
StatTrend
typeDirection of a change.
StatFormat
typeValue format: "number", "compact", "percent", "currency", Intl options or a function.
StatVariant
typeAppearance: card a bordered card, plain without a frame.
StatProps
interfaceStat props.
| Name | Type | Default | Description |
|---|---|---|---|
label | ReactNode | Name of the metric (e.g. "Monthly revenue"). | |
value | number | ReactNode | Value. A number is written per format, locale-aware. | |
format? | StatFormat | "number" | Format of a numeric value. |
prefix? | ReactNode | Prefix before the value (e.g. "≈"). | |
suffix? | ReactNode | Unit after the value (e.g. "pcs"). | |
previousValue? | number | Value of the previous period; when given the change ratio is computed. | |
change? | number | Change ratio: 0.125 = a 12.5% increase. Computed from previousValue if omitted. | |
changeFormat? | StatFormat | "percent" | Format of the change. |
changeLabel? | ReactNode | Period written next to the change (e.g. "vs last month"). | |
higherIsBetter? | boolean | true | Is an increase good? false for metrics like cost or error count. |
description? | ReactNode | Description under the value. | |
icon? | IconProp | Icon next to the label. | |
sparkline? | readonly (number | null | undefined)[] | Data of the trend chart. | |
sparklineType? | "line" | "area" | "bar" | "area" | Chart type. |
sparklineColor? | ChartColor | Chart color; based on the trend if omitted. | |
animate? | boolean | false | Count up whenever the number changes. Off when "reduce motion" is on. |
loading? | boolean | Placeholder while loading. | |
action? | ReactNode | Action in the top right corner. | |
variant? | StatVariant | (string & {}) | "card" | Appearance: one of the built-in variants or a name added via appearance.variants.stat. |
effect? | EffectProp | Effect or effects ("lift", "glow", "beam"…). Defaults to appearance.defaults.stat.effect. See BuiltinEffect. | |
size? | "sm" | "md" | "lg" | "md" | Size. |
locale? | string | {@link UIProvider} `locale | Locale. |
currency? | string | {@link UIProvider} `currency | Currency. |
style? | StyleProp<ViewStyle> | Container style. |