I would like to apply a dark theme to a shiny application:
library(shinythemes)
shinyUI(fluidPage(
theme = shinytheme("cyborg"),
...)
But the DT datatable does not follow the theme color.
How can I make it dark ?
Thanks a lot.
In addition to your posted code, you must also add the following argument to your datatable
function. Fully reproducible code below.
library(shiny)
library(DT)
library(shinythemes)
ui <- fluidPage(
theme = shinytheme("cyborg"),
mainPanel(
DTOutput("table")
)
)
server <- function(input, output){
output$table <- renderDT({
datatable(iris,
style = "bootstrap" # <--------- This is the crucial part
)
})
}
# Create Shiny app ----
shinyApp(ui, server)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With