Skip to contents

The .style pronoun allows defining styles within the function call of a tag element. Without the .style pronoun tag element styles are applied outside and after constructing a tag element.

div() %>%
  background_color("primary") %>%
  display("flex") %>%
  flex_justify("between")

Once the content of a tag element grows to more than a few lines, associating the element's styles with the element becomes less and less intuitive. In these situations, make use of the .style pronoun.

div(
  .style %>%
    border_color(theme_primary()) %>%
    text_color(theme_primary()),
  p("Paragraph"),
  p("Paragraph"),
  p("Paragraph")
)