A compact stat card: a label, a large value, an optional trend delta chip, an optional icon, caption, and sparkline slot. Grid-friendly – drop several into a CSS grid for a KPI row.
Arguments
- value
The headline value (string or number; tags allowed).
- label
The stat label.
- delta
Optional delta text (e.g.
"+20.1%"). Rendered as a chip.- delta_direction
Trend for the chip:
"auto"(default – inferred from a leading+/-indelta),"up","down", or"neutral".- icon
Optional icon: a
shad_icon()name or a tag, pinned top-right.- caption
Optional muted caption line below the value.
- sparkline
Optional tag/output filling a small strip at the bottom (e.g. an inline
<svg>or aplotOutput()).- size
"md"(default),"sm", or"lg".- href
Optional URL; makes the whole box a link.
- class
Extra CSS classes.
- ...
Extra attributes on the root.
See also
Other shadshiny dashboard:
shad_chart_container(),
shad_mini_donut(),
shad_sparkline(),
shad_timeline(),
shad_timeline_item()
Examples
shad_value_box("$45,231.89", "Total revenue", delta = "+20.1%",
caption = "vs. last month")
#> <div class="shad-value-box">
#> <div class="shad-value-box__label">Total revenue</div>
#> <div class="shad-value-box__value">
#> $45,231.89
#> <span class="shad-value-box__delta" data-trend="up">
#> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17L17 7M7 7h10v10"/></svg>
#> +20.1%
#> </span>
#> </div>
#> <div class="shad-value-box__caption">vs. last month</div>
#> </div>