solo_box: solo_box

Description Usage Arguments Examples

View source: R/tile_maker.R

Description

This function crafts the actual tile per se, including the specific aesthetic traits for each tile. This is the simple version where you explicitly state the color.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
solo_box(
  value = NULL,
  txt = NULL,
  former = NULL,
  size = "md",
  icon = NULL,
  color = "info",
  link = NULL,
  units = NULL,
  hover = NULL,
  textModifier = "h1",
  pretty = NULL,
  ...
)

Arguments

value

The numeric value you want to highlight (the main enchilada)

txt

Optional subtext that should appear under the value

former

The numeric old value to use for comparison to 'value'

size

Optional size specified in the bootstrap css classes: "xs","sm","md","lg")

icon

Optional glyphicon that should be displayed from https://getbootstrap.com/docs/3.3/components/ you need only supply the name of thing you want, like "check"... not the full "gyphicon-check"

color

Optional bootstrap css element that governs the color. https://v4-alpha.getbootstrap.com/utilities/colors/ Choose from: "muted", "primary", "success", "info", "warning", "danger"

link

Optional hyperlink that should be followed on click

units

Optional units that should be displayed after Value

hover

Optional tooltip, or text that will show up when a user rests their mouse over the tile.

textModifier

Optional css category of "large" text. In this case, the icon, value and unit. In this case, title. Default=h1

pretty

Optionally allow numbers to become embellished. Accepted values are NULL (default), or the desired divider (",", ".", " ", etc). If this option is not left as FALSE, rounding is automatically implemented.

...

Optional additional html elements. For example, if you would like two buttons to fit into a section in a flexdashboard, you could specify style = 'width:100%;height:50%'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
b1 <- solo_box(color = "warning", value = 3.57, txt = "B")
b2 <- solo_box(color = "danger", value = 13.7, txt = "Nutritional value")
b3 <- solo_box(color = "success", value = 1, txt = "Yumminess factor")
b4 <- solo_box(value = 3.57, former = 3, txt = "Times apple eaten", icon = "apple")
finisher(title = "straight buttons", divs = b1)
finisher(
  title = "with divs",
  divs = div_maker(
    subtitle = "boom",
    textModifier = "h1",
    div_maker(subtitle = "Boom", textModifier = "hi", b1, b2, b3)
  )
)

## Or taking advantage of the ability to change the textModifier:
finisher(
  title = "h4 modifier",
  divs = solo_box(
    value = 3, txt = "uh huh",
    former = 2, textModifier = "h4"
  )
)

DataStrategist/TileMaker documentation built on Feb. 1, 2022, 9:29 p.m.