Skip to contents

The text_weight() function adjusts the font weight of a tag element.

Usage

text_weight(x, weight)

Arguments

x

A tag element or .style pronoun.

weight

A character string specifying the font weight. One of,

  • "bold"

  • "bolder"

  • "semibold"

  • "medium"

  • "normal"

  • "light"

  • "lighter"

    "bolder" and "lighter" change the font weight relative to the current font weight.

Value

An object of the same type as x.

Examples


library(htmltools)

p(
  .style %>%
    text_weight("bold"),
  "Bold"
)
#> <p class="fw-bold">Bold</p>

p(
  .style %>%
    text_weight("light"),
  "Light"
)
#> <p class="fw-light">Light</p>