Stat and metric display components for Pure Admin.
Supports multiple variants: default (with optional icon), hero, hero-compact, and square.
Summary
Functions
Renders a stat display.
Functions
Renders a stat display.
Variants
- default: Simple number + label (optionally with icon)
"hero": Large prominent stat with change indicator"hero-compact": Compact hero variant"square": Colored square stat with optional symbol
Examples
<.stat number="1,234" label_text="Total Users" />
<.stat variant="hero" number="$12,345" label_text="Revenue"
change_text="+12.5%" change_direction="positive" />
<.stat variant="square" color="primary" number="42" label_text="Tasks" />
<.stat number="99.9%" label_text="Uptime" icon_variant="success">
<:icon><i class="fa-solid fa-check-circle"></i></:icon>
</.stat>Attributes
variant(:string) - Stat display variant. Defaults tonil. Must be one ofnil,"hero","hero-compact", or"square".color(:string) - Color for square variant. Defaults tonil. Must be one ofnil,"primary","secondary","success","info","warning", or"danger".icon_variant(:string) - Icon color variant. Defaults to"primary". Must be one of"primary","secondary","success","info","warning", or"danger".number(:string) - Value to display. Defaults tonil.label_text(:string) - Label text. Defaults tonil.change_text(:string) - Change text (e.g. '+12.5%') for hero variant. Defaults tonil.change_direction(:string) - Change direction (determines color). Defaults tonil. Must be one ofnil,"positive","negative", or"neutral".symbol_text(:string) - Symbol text for square variant. Defaults tonil.value(:string) - Legacy alias for number. Defaults tonil.label(:string) - Legacy alias for label_text. Defaults tonil.trend(:string) - Legacy alias for change_text. Defaults tonil.trend_direction(:string) - Legacy alias for change_direction (up/down). Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
icon- Icon content.inner_block- Custom layout content (overrides default rendering).