Short figures side by side: the label over the number, a divider between them, inside a card, a sunken strip or a bare row.
<.stat_group>
<.stat_item label="Subtotal" value="R$ 3.240" />
<.stat_item label="Desconto" value="− R$ 120" />
<.stat_item label="Total" value="R$ 3.120" tone="accent" />
</.stat_group>
<.stat_group animated>
<.stat_item
icon="wallet"
label="Faturamento"
value="R$ 184.320"
change="12,4%"
note="vs. outubro"
sparkline={[0, 3.5, 2.3, 6.1, 5.2, 8.7, 11, 9.8, 13.3, 15.1, 17.7, 22]}
/>
</.stat_group>The vitrine names work as aliases: delta (change), hint (note), goal (meter), spark
(sparkline) and delta_tone (change_tone, with good/bad).
stat_item/1 carries everything a figure can say: a unit (dias, un), a change with its
direction (trend) and tone (good or bad news), a note under the figure, a goal meter and a
sparkline (a list of numbers). tone="accent" highlights the total of a strip and size="sm"
sets a word (Boleto) instead of a number. stat_group draws the lu-stats strip: card (the
default) frames it, card={false} leaves a bare row, variant="sunken" fills it with the
sunken background, and animated adds the canvas loop (mo-stats): the figures rise, the lines
draw and the changes pop in.
Summary
Functions
Attributes
card(:boolean) - Frames the strip;falseleaves a bare row. Defaults totrue.variant(:string) - Defaults to"default". Must be one of"default", or"sunken".animated(:boolean) - The canvas loop (mo-stats). Defaults tofalse.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Attributes
label(:string) (required)value(:string) (required) - The figure, already formatted.unit(:string) - A smaller faint suffix beside the figure. Defaults tonil.icon(:string) - An icon name before the label. Defaults tonil.tone(:string) - Defaults to"default". Must be one of"default", or"accent".size(:string) - Defaults to"default". Must be one of"default", or"sm".change(:string) - The variation, already formatted (12,4%). Defaults tonil.trend(:string) - The arrow ofchange. Defaults to"up". Must be one of"up","down", or"flat".change_tone(:string) - Good (pos) or bad (neg) news; by defaultpos, orflatwhentrendis flat. Defaults tonil. Must be one ofnil,"pos","neg", or"flat".note(:string) - The faint line under the figure (vs. outubro). Defaults tonil.meter(:integer) - Goal progress, 0 to 100: draws the bar. Defaults tonil.sparkline(:list) - Numbers of a trend (at least two); the last one is the dot. Defaults tonil.sparkline_tone(:string) - Defaults to"acc". Must be one of"acc","pos", or"mut".delta(:string) - Alias ofchange. Defaults tonil.hint(:string) - Alias ofnote. Defaults tonil.goal(:integer) - Alias ofmeter. Defaults tonil.spark(:list) - Alias ofsparkline. Defaults tonil.delta_tone(:string) - Alias ofchange_tone;goodisposandbadisneg. Defaults tonil. Must be one ofnil,"pos","neg","flat","good", or"bad".class(:any) - Defaults tonil.- Global attributes are accepted.