Stat Cards
Totals above a list or on a dashboard: figures on their own or on cards that are static, pressable, links or filters.
Overview
Stat
A label (StatLabel), a value (StatValue, formatted by the app, with isLoading and isUnavailable states), an optional StatIcon (a soft IconTile) and a StatDescription.
- `tone`:
default,success,warning,info,destructiveormuted; tints the icon and the value. - `size="lg"`: enlarges the value.
On its own, Stat has no surface, for several figures inside one card.
Cards
- `StatCard`: static.
- `StatCardButton`: runs
onPress, or opens a dialog as the child of aDialogTrigger. - `StatCardLink`: navigates, e.g. to the list already filtered.
- `StatCardToggle`: the selectable cards of a
StatCardGroup, a react-ariaToggleButtonGroupthat filters a list.selectionMode="single"behaves like radios and"multiple"like checkboxes, controlled byselectedKeys/onSelectionChangeso it maps to a search param.
StatGrid and StatCardGroup lay cards out in as many columns as fit, and their i18n.labels reach every value inside.
Installation
CLI
Manual
- 1
Register the @fma-ds namespace in components.json (once)
- 2
Add the item
Files land in
components/fma-ds/stat-cards/stat-cards.tsx; npm and registry dependencies are installed along with them.
Dependencies
- npm
- class-variance-authority@^0.7.1cn@^0.5.0react-aria-components@^1.22.1