The text_wrap() adjusts how text is wrapped, or not wrapped, in a tag
element.
Arguments
- x
A tag element or .style pronoun.
- wrap
A boolean. One of,
TRUEFALSE
See also
Other text utilities:
text_alignment(),
text_break(),
text_color(),
text_decoration(),
text_height(),
text_selection(),
text_style(),
text_transform(),
text_weight()
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>