| lt_style | R Documentation |
Apply CSS styling to specific cells. Target cells by column, row, or both.
When test is provided, styles are applied conditionally based on cell
values (evaluated in JavaScript).
lt_style(
x,
columns = NULL,
rows = NULL,
test = NULL,
class = NULL,
bold = NULL,
italic = NULL,
color = NULL,
bg = NULL,
...
)
x |
An |
columns |
Character vector of column names, a one-sided formula, or
|
rows |
Integer vector of 1-based row indices (or |
test |
A JavaScript function as a string (e.g., |
class |
CSS class name(s) to add to matching cells. Define the
corresponding rules in an external stylesheet via |
bold |
Logical: apply bold weight? |
italic |
Logical: apply italic style? |
color |
Text color (any CSS color value, e.g., |
bg |
Background color. |
... |
Additional CSS properties as named arguments. Names can be
camelCase (e.g., |
x with the style recorded.
tbl = lt(head(mtcars))
tbl |>
lt_style("mpg", rows = 1L, bold = TRUE, borderBottom = "2px solid red")
tbl |>
lt_style("mpg", test = "v => v > 20", class = "high") |>
lt_css(.high = list(background = "#cfc"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.