0

The code below is from Kyle Cuilla's page on themes https://kcuilla.github.io/reactablefmtr/articles/themes.html

In the displayed output on his page, it shows a nice sans serif font. But when I run it, I get some kind of Times font. I've looked through the docs and can't see where the default font is set (which I appreciate I may not have installed, but I'm pretty sure it was working before).

library(tidyverse)
remotes::install_github("kcuilla/reactablefmtr", force = TRUE)
library(reactablefmtr)
install.packages("viridis")
library(viridis)

data <- MASS::Cars93[1:20, c("Make", "Cylinders", "MPG.city", "Price")]
data %>%
  reactable(.,
            theme = slate(),
            defaultColDef =
              colDef(
                cell = data_bars(., fill_color = viridis::mako(5), text_position = "inside-end")
              )
  )

enter image description here

Chris
  • 1,449
  • 1
  • 18
  • 39

1 Answers1

3

One option would be the google_font function which allows to apply a google font to your table:

library(magrittr)
library(reactablefmtr)
#> Loading required package: reactable
library(viridis)
#> Loading required package: viridisLite

data <- MASS::Cars93[1:20, c("Make", "Cylinders", "MPG.city", "Price")]
data %>%
  reactable(.,
            theme = slate(),
            defaultColDef =
              colDef(
                cell = data_bars(., fill_color = viridis::mako(5), text_position = "inside-end")
              )
  ) %>% 
  google_font(font_family = "Source Sans Pro")

stefan
  • 90,330
  • 6
  • 25
  • 51