Skip to contents

The text_wrap() adjusts how text is wrapped, or not wrapped, in a tag element.

Usage

text_wrap(x, wrap)

Arguments

x

A tag element or .style pronoun.

wrap

A boolean. One of,

  • TRUE

  • FALSE

Value

An object of the same type as x.

Examples


library(htmltools)

div(
  style = "width: 5rem;",
  .style %>%
    background_color(theme_primary()) %>%
    text_wrap(TRUE),
  "Wrap text to fit the element"
)
#> <div style="width: 5rem;" class="bg-primary text-wrap">Wrap text to fit the element</div>

div(
  style = "width: rem;",
  .style %>%
    background_color(theme_secondary()) %>%
    text_wrap(FALSE),
  "This text won't wrap onto a new line."
)
#> <div style="width: rem;" class="bg-secondary text-nowrap">This text won't wrap onto a new line.</div>