# NOT RUN {
## Create the reactable table and then pipe in the legend
library(dplyr)
data <- iris[10:29, ]
table <- reactable(data,
columns = list(Petal.Length = colDef(
cell = icon_sets(data, icon_set = "medals"))))
table %>%
add_icon_legend(icon_set = "medals")
## The legend can be aligned to the left or right of the table
table %>%
add_icon_legend(icon_set = "medals", align = "left")
## Add custom labels to each icon in the legend
table %>%
add_icon_legend(icon_set = "medals", labels = c("Shortest Length","Avg Length","Longest Length"))
## Add a title and footer to the legend
table %>%
add_icon_legend(icon_set = "medals", title = "Icon Legend Title", footer = "Icon Legend Footer")
# }
Run the code above in your browser using DataLab