text: Text

Description Usage Arguments Colors Examples

View source: R/text.R

Description

The text() function adjusts the text color, alignment, line spacing, line wrapping, line height, and decoration of a tag element.

Usage

1
2
3
4
5
6
7
8
9
text(
  x,
  color = NULL,
  align = NULL,
  spacing = NULL,
  decoration = NULL,
  wrap = NULL,
  select = NULL
)

Arguments

x

A tag element or .style pronoun.

color

One of "blue", "indigo", "purple", "red", "orange", "yellow", "green", "teal", "cyan", "black-50", "white-50", "white", "muted", "body", or "reset" specifying the text color, defaults to NULL, in which case the argument is ignored.

align

One of "left", "right", or "center" specifying the alignment of the text within the element, defaults to NULL, in which case the argument is ignored.

spacing

One of "sm", "small", "md", "medium", "lg", or "large" specifying the text line spacing, defaults to NULL, in which case the argument is ignored.

decoration

One of "none", "underline", or "strikethrough" specifying how the text is decorated, defaults to NULL, in which case the argument is ignored.

wrap

One of TRUE or FALSE specifying if an element's text should wrap onto new lines, defaults to NULL, in which case the argument is ignored.

select

One of "all" or "none" specifying how the element's text is selected when the user clicks on the element, defaults to NULL, in which case the argument is ignored.

Colors

div(
  .style %>%
    text("blue") %>%  # <-
    border("blue"),
  p("Nullam tristique diam non turpis.",
    "Pellentesque dapibus suscipit ligula.",
    "Nullam eu ante vel est convallis dignissim."),
  p("Aliquam posuere.")
)
html_preserve

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

Aliquam posuere.

/html_preserve

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(htmltools)

div(
  .style %>%
    text(spacing = "small"),
  "Nam vestibulum accumsan nisl.",
  "Fusce commodo."
)

div(
  .style %>%
    text(spacing = "large"),
  "Suspendisse potenti.",
  "Pellentesque tristique imperdiet tortor."
)

tags$button(
  .style %>%
    text(wrap = FALSE),
  "Aliquam feugiat tellus ut neque."
)

cascadess documentation built on Jan. 13, 2021, 5:10 p.m.