'Tooltip on a cell reactable R

The reactable documentation provides one exemple on adding a tooltip on headers.

Here is an exemple to add a tooltip for a cell.

data <- mtcars[1:5, c("mpg", "cyl")]
data$tooltipcell<-"<span title='your content'>this is a car</span>"
with_tooltip <- function(value, tooltip) {
  span(style = "text-decoration: underline; text-decoration-style: dotted;", title = tooltip, value)
}

reactable(
  data,
  columns = list(
    mpg = colDef(name="mpg"),
    cyl = colDef(header = with_tooltip("cyl", "Number of cylinders")),
    tooltipcell=colDef(html = TRUE)
  )
)
r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source