font: Font color, size, weight

Description Usage Arguments See Also Examples

View source: R/design.R

Description

The font() utility modifies the color, size, weight, case, or alignment of a tag element's text. All arguments default to NULL, in which case they are ignored. For example, font(.., size = "lg") increases font size without affecting color, weight, case, or alignment.

Usage

1
font(tag, color = NULL, size = NULL, weight = NULL, case = NULL, align = NULL)

Arguments

tag

A tag element.

color

One of "red", "purple", "indigo", "blue", "cyan", "teal", "green", "yellow", "amber", "orange", "grey", "black" or "white" specifying the text color of the tag element, defaults to NULL

size

One of "xs", "sm", "base", "lg", "xl" specifying a font size relative to the default base page font size, defaults to NULL.

weight

One of "bold", "normal", "light", "italic", or "monospace" specifying the font weight of the element's text, defaults to NULL.

case

One of "upper", "lower", or "title" specifying a transformation of the tag element's text, default to NULL.

align

A responsive argument. One of "left", "center", "right", or "justify", specifying the alignment of the tag element's text, defaults to NULL.

See Also

Other design utilities: active(), affix(), background(), border(), display(), float(), height(), padding(), scroll(), shadow(), width()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
### Changing text color

card(
  header = h3("Important!") %>%
    font(color = "amber"),
  div(
    "This is a reminder."
  )
) %>%
  border(color = "amber")

### Changing font size

div(
  p("Extra small") %>%
    font(size = "xs"),
  p("Small") %>%
    font(size = "sm"),
  p("Medium") %>%
    font(size = "base"),
  p("Large") %>%
    font(size = "lg"),
  p("Extra large") %>%
    font(size = "xl")
)

### Changing font weight

# Make an element's text bold, italic, light, or monospace.

p("Curabitur lacinia pulvinar nibh.") %>%
  font(weight = "bold")

p("Proin quam nisl, tincidunt et.") %>%
  font(weight = "light")

yonder documentation built on Jan. 11, 2020, 9:35 a.m.