value_box {bslib} | R Documentation |
An opinionated (card()
-powered) box, designed for displaying a value
and
title
. Optionally, a showcase
can provide for context for what the
value
represents (for example, it could hold a bsicons::bs_icon()
, or
even a shiny::plotOutput()
).
value_box(
title,
value,
...,
showcase = NULL,
showcase_layout = showcase_left_center(),
full_screen = FALSE,
theme_color = "primary",
height = NULL,
max_height = NULL,
fill = TRUE,
class = NULL
)
showcase_left_center(
width = 0.3,
max_height = "100px",
max_height_full_screen = 0.67
)
showcase_top_right(
width = 0.3,
max_height = "75px",
max_height_full_screen = 0.67
)
title , value |
A string, number, or |
... |
Unnamed arguments may be any |
showcase |
A |
showcase_layout |
either |
full_screen |
If |
theme_color |
A theme color to use for the background color. Should
match a name in the Bootstrap Sass variable |
height |
Any valid CSS unit (e.g.,
|
max_height , max_height_full_screen |
A proportion (i.e., a number between 0 and 1) or any valid CSS unit defining the showcase max_height. |
fill |
Whether to allow the value box to grow/shrink to fit a fillable
container with an opinionated height (e.g., |
class |
Utility classes for customizing the appearance of the summary
card. Use |
width |
one of the following:
|
library(htmltools)
if (interactive()) {
value_box(
"KPI Title",
h1(HTML("$1 <i>Billion</i> Dollars")),
span(
bsicons::bs_icon("arrow-up"),
" 30% VS PREVIOUS 30 DAYS"
),
showcase = bsicons::bs_icon("piggy-bank"),
class = "bg-success"
)
}