Indicator card: a big tabular figure, its unit in subtle and a coloured delta in the footer.
<.kpi_card label="MRR" value="184,320" prefix="$" delta="8.8%" compare="vs $169,460 in Sep"
live spark={@mrr_series} open_label="Open" on_open="open_report" />
<.kpi_card label="Churn rate" value="2.1" unit="%" delta="0.4 pts" trend="up" delta_tone="error" />The colour of the delta follows the meaning, not the direction: churn going up is error
(a red arrow pointing up). trend draws the arrow (up, down, flat), delta_tone colours it
and defaults from trend (up success, down error, flat neutral).
Variants
canvas(default): the reference card. The sparkline sits at the right (spark), the delta is alu-deltaand the arrow an icon.badge: the compact card of the dashboards, with the delta in alu-badgeand the arrow as a glyph (↗,↘,→); pair it withcountfor a figure that counts up (CSS only).
With an <:icon>, layout="stack" puts the icon chip before the label and "inline" puts it
beside the label and the figure.
The sparkline is drawn on the server (see LedgerUI.Components.Sparkline). The gradient of its
fill takes its id from id (derived from the card's content when not given).
Summary
Functions
Attributes
id(:string) - Defaults tonil.label(:string) - Defaults tonil.value(:string) - The figure, already formatted. Defaults tonil.prefix(:string) - A small prefix before the figure ($,R$). Defaults tonil.unit(:string) - A smaller suffix beside the figure (mil,%,dias). Defaults tonil.delta(:string) - The change since the last period, already formatted. Defaults tonil.compare(:string) - What the change is measured against (vs Sep). Defaults tonil.trend(:string) - Defaults to"up". Must be one of"up","down", or"flat".delta_tone(:string) - Defaults tonil.Must be one ofnil,"success","error", or"neutral".spark(:list) - Numbers for the sparkline. Defaults to[].color(:string) - Defaults to"primary". Must be one of"neutral","primary","secondary","info","success","warning", or"error".variant(:string) - Defaults to"canvas". Must be one of"canvas", or"badge".layout(:string) - Defaults to"inline". Must be one of"stack", or"inline".count(:integer) -badgevariant: the figure counts up to this number, in CSS. Defaults tonil.progress(:integer) - 0 to 100: a meter under the figure, in place of the sparkline. Defaults tonil.caption(:string) - A faint line under the figure or the meter. Defaults tonil.icon_tone(:string) - Defaults to"acc". Must be one of"acc","pos","neg","warn", or"info".value_id(:string) - Theidof the figure element. Defaults tonil.gap(:boolean) - Defaults totrue.loading(:boolean) - Defaults tofalse.live(:boolean) - ALivechip beside the label. Defaults tofalse.live_label(:string) - Defaults to"Live".open_label(:string) -aria-labelof the round button at the footer's right; no button without it. Defaults tonil.on_open(:any) - Event name or%JS{}of the round button. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
icon- An icon shown in a tinted chip before the label.