font: Font color, size, weight

View source: R/design-font.R

fontR Documentation

Font color, size, weight

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

font(x, color = NULL, size = NULL, weight = NULL, case = NULL, align = NULL)

Arguments

x

A tag element or .style pronoun.

color

One of "primary", "secondary", "success", "info", "warning", "danger", "light" or "dark" specifying the text color of the tag element, defaults to NULL.

size

Deprecated, in future versions of bootstrap resonsive font sizing will be enabled by default, https://github.com/twbs/bootstrap/pull/29152.

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", "bolder", "normal", "lighter", or "light" specifying the font weight of the element's text, defaults to NULL. "bolder" and "lighter" change the weight relative to the current font weight of the element.

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.

Details

Getting started

The font utility is used to change text colors, font weights, and more.

Changing text color

card(
  .style %>%
    font("primary") %>%
    border("primary"),
  header = h3("Header"),
  p("Nullam tristique diam non turpis.",
    "Pellentesque dapibus suscipit ligula.",
    "Nullam eu ante vel est convallis dignissim."),
  p("Aliquam posuere.")
)

Header

Nullam tristique diam non turpis. Pellentesque dapibus suscipit ligula. Nullam eu ante vel est convallis dignissim.

Aliquam posuere.

Changing font weight

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

Curabitur lacinia pulvinar nibh.

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

Proin quam nisl, tincidunt et.

See Also

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


nteetor/yonder documentation built on June 8, 2022, 1:36 p.m.