icontext: Create icon-text elements

Description Usage Arguments See Also Examples

View source: R/style.R

Description

Create icon-text elements

Usage

1
2
3
4
5
6
7
8
9
icontext(
  icon,
  text = list(NULL),
  ...,
  simplify = TRUE,
  provider = getOption("formattable.icon.provider", "glyphicon"),
  class_template = getOption("formattable.icon.class_template",
    "{provider} {provider}-{icon}")
)

Arguments

icon

a character vector or list of character vectors of icon names.

text

a character vector of contents.

...

additional parameters (reserved)

simplify

logical to indicating whether to return the only element if a single-valued list is resulted.

provider

the provider of icon set.

class_template

a character value to specifiy to template of the class with "{provider}" to represent provider value and "{icon}" to represent icon values.

See Also

Glyphicons in Bootstrap, Glyphicons

Examples

1
2
3
4
icontext("plus")
icontext(c("star","star-empty"))
icontext(ifelse(mtcars$mpg > mean(mtcars$mpg), "plus", "minus"), mtcars$mpg)
icontext(list(rep("star",3), rep("star",2)), c("item 1", "item 2"))

Example output

<i class="glyphicon glyphicon-plus"></i>
[[1]]
<i class="glyphicon glyphicon-star"></i>

[[2]]
<i class="glyphicon glyphicon-star-empty"></i>

[[1]]
<i class="glyphicon glyphicon-plus"></i>
21

[[2]]
<i class="glyphicon glyphicon-plus"></i>
21

[[3]]
<i class="glyphicon glyphicon-plus"></i>
22.8

[[4]]
<i class="glyphicon glyphicon-plus"></i>
21.4

[[5]]
<i class="glyphicon glyphicon-minus"></i>
18.7

[[6]]
<i class="glyphicon glyphicon-minus"></i>
18.1

[[7]]
<i class="glyphicon glyphicon-minus"></i>
14.3

[[8]]
<i class="glyphicon glyphicon-plus"></i>
24.4

[[9]]
<i class="glyphicon glyphicon-plus"></i>
22.8

[[10]]
<i class="glyphicon glyphicon-minus"></i>
19.2

[[11]]
<i class="glyphicon glyphicon-minus"></i>
17.8

[[12]]
<i class="glyphicon glyphicon-minus"></i>
16.4

[[13]]
<i class="glyphicon glyphicon-minus"></i>
17.3

[[14]]
<i class="glyphicon glyphicon-minus"></i>
15.2

[[15]]
<i class="glyphicon glyphicon-minus"></i>
10.4

[[16]]
<i class="glyphicon glyphicon-minus"></i>
10.4

[[17]]
<i class="glyphicon glyphicon-minus"></i>
14.7

[[18]]
<i class="glyphicon glyphicon-plus"></i>
32.4

[[19]]
<i class="glyphicon glyphicon-plus"></i>
30.4

[[20]]
<i class="glyphicon glyphicon-plus"></i>
33.9

[[21]]
<i class="glyphicon glyphicon-plus"></i>
21.5

[[22]]
<i class="glyphicon glyphicon-minus"></i>
15.5

[[23]]
<i class="glyphicon glyphicon-minus"></i>
15.2

[[24]]
<i class="glyphicon glyphicon-minus"></i>
13.3

[[25]]
<i class="glyphicon glyphicon-minus"></i>
19.2

[[26]]
<i class="glyphicon glyphicon-plus"></i>
27.3

[[27]]
<i class="glyphicon glyphicon-plus"></i>
26

[[28]]
<i class="glyphicon glyphicon-plus"></i>
30.4

[[29]]
<i class="glyphicon glyphicon-minus"></i>
15.8

[[30]]
<i class="glyphicon glyphicon-minus"></i>
19.7

[[31]]
<i class="glyphicon glyphicon-minus"></i>
15

[[32]]
<i class="glyphicon glyphicon-plus"></i>
21.4

[[1]]
<i class="glyphicon glyphicon-star"></i>
<i class="glyphicon glyphicon-star"></i>
<i class="glyphicon glyphicon-star"></i>
item 1

[[2]]
<i class="glyphicon glyphicon-star"></i>
<i class="glyphicon glyphicon-star"></i>
item 2

formattable documentation built on Jan. 13, 2021, 7:17 a.m.