set_formatter_toggle_switch | R Documentation |
Set toggle switch formatter
set_formatter_toggle_switch(
widget,
column,
size = 20,
on_value = "on",
off_value = "off",
on_truthy = FALSE,
on_color = "green",
off_color = "red",
clickable = TRUE
)
widget |
A |
column |
The name of the column the formatter is applied to. |
size |
(numeric): The size of the switch in pixels. |
on_value |
(character): The value of the cell for the switch to be on. |
off_value |
(character) The value of the cell for the switch to be off. |
on_truthy |
(bool): Whether to show the switch as on if the value of the cell is truthy. |
on_color |
(character): The color of the switch if it is on. |
off_color |
(character): The color of the switch if it is off. |
clickable |
(bool): Enable switch functionality to toggle the cell value on click. |
The updated tabulator()
HTML widget
data <- data.frame(
Language = c("R", "Python", "Julia"),
Available = c("yes", "yes", "no")
)
tabulator(data) |>
set_formatter_toggle_switch("Available", on_value = "yes", off_value = "no")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.