rstudio / bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
https://rstudio.github.io/bslib/
Other
486 stars 58 forks source link

Unable to apply theme to DT using `bs_theme` #235

Closed JamesHWade closed 3 years ago

JamesHWade commented 3 years ago

I am unable to apply the theme to with {DT}. I've tried to create a reprex (below). Any suggestions?

library(shiny)
library(bslib)
library(DT)

ui <- fluidPage(
    theme = bs_theme(bootswatch = "superhero"),
    dataTableOutput("carsTable"))

server <- function(input, output) {
    output$carsTable <- renderDataTable(datatable(mtcars))
}

shinyApp(ui = ui, server = server)

Created on 2021-01-25 by the reprex package (v0.3.0)

R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS: /share/apps/R/openblas/OpenBLAS-0.2.19/libopenblas.so LAPACK: /share/apps/R/R-4.0.3-openblas/lib64/R/lib/libRlapack.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] reprex_0.3.0 DT_0.16 bslib_0.2.4.9000 shiny_1.5.0.9007

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 pillar_1.4.7 compiler_4.0.3 later_1.1.0.1
[5] jquerylib_0.1.3 tools_4.0.3 digest_0.6.27 packrat_0.5.0
[9] jsonlite_1.7.2 evaluate_0.14 lifecycle_0.2.0 tibble_3.0.4
[13] pkgconfig_2.0.3 rlang_0.4.10 rstudioapi_0.13 yaml_2.2.1
[17] xfun_0.19 fastmap_1.0.1 withr_2.4.0 knitr_1.30
[21] fs_1.5.0 htmlwidgets_1.5.2 sass_0.3.0 vctrs_0.3.6
[25] R6_2.5.0 processx_3.4.5 rmarkdown_2.5 callr_3.5.1
[29] clipr_0.7.1 magrittr_2.0.1 whisker_0.4 promises_1.1.1
[33] ps_1.5.0 ellipsis_0.3.1 htmltools_0.5.1 mime_0.9
[37] xtable_1.8-4 httpuv_1.5.5 crayon_1.3.4

cpsievert commented 3 years ago

At least for right now, you'll have to specify the relevant style, for example: datatable(mtcars, style = "bootstrap4")

Hopefully you won't need to in a future version of {DT} (see https://github.com/rstudio/DT/pull/852).

Closing since this is really a {DT} issue, not a {bslib} issue.

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue. :raising_hand: Need help? Connect with us on Discord or Posit Community.