Skip to main content

Stats Component

stats renders read-only totals, counts, and headline values. Templates resolve against the UI store, enclosing form values, and component variables (variables have highest precedence). Empty values render as an em dash; zero remains visible.

component: stats
name: orderTotals
props:
variant: row
size: md
align: end
items:
- label: Weight
value: "{{ orderSummary.totalWeight }}"
unit: lb
decimals: 2
- label: Pieces
value: "{{ orderSummary.totalPieces }}"
PropTypeDescription
itemsarrayValues to render
items[].labelstring or localized valueShort label for the value
items[].valueany/templateDisplayed value
items[].unitany/templateMuted unit shown after a non-empty value
items[].captionstring or localized valueAdditional muted caption
items[].decimalsnumberMaximum decimal places for numeric values
items[].emphasisbooleanIn list mode, bolds the item and separates it with a rule
items[].iconstring/templateIn cards mode, a Tabler icon shown in a tinted tile
items[].colorprimary, secondary, success, info, warning, or errorIn cards mode, the icon-tile color; defaults to primary
variantrow, list, or cardsHorizontal stats (default), receipt-like label/value rows, or a responsive strip of equal cards
sizesm, md, or lgValue/card density. For cards, md is the default and sm is about one third smaller; for row, lg places the label above the value
alignstart or endAlignment for row mode
classNamestringAdditional CSS classes

items is required. npx cxtms rejects an unknown variant, size or align, an item color outside the list above, and any item key not in this table, so a typo like colr fails validation instead of being silently ignored.

For grid totals, place a cards strip directly above the grid so the summary stays prominent and wraps on narrow screens:

- component: stats
name: cartonTotals
props:
variant: cards
items:
- label: Cartons
value: "{{ orderSummary.totalPieces }}"
icon: tabler-package
- label: Weight
value: "{{ orderSummary.totalWeight }}"
unit: lb
icon: tabler-weight
color: info
- component: dataGrid
name: cartonsGrid
# ...

row and list remain useful for compact summaries and card-header totals.