Search code examples
rthemesshinyshinythemes

shinythemes not kicking in


I am using the library shinythemes and creating an UI with theme "united"

For some reason I cannot see this theme applied to my Shiny UI, below is my UI code.

ui = shinyUI(fluidPage(theme=shinytheme("united"),
                       title = 'Research Productivity',
                       tabsetPanel(
                         tabPanel("Test",
                                  fluidRow(
                                    column(width = 2,
                                           h4("Functions"),
                                           wellPanel(
                                             #radioButtons("editingCol0", "Rownames editing", choices = c("Enable" = TRUE, "Disable" = FALSE), selected = FALSE)
                                           )
                                    ),
                                    column(width = 12, 
                                           h4("test_data1"),
                                           d3tfOutput('test_data1', height = "auto")
                                    )
                                    #                                     ),
                                    #                                     column(width = 5,
                                    #                                            
                                    #                                            h4("test_data1 after filtering and editing"),
                                    #                                            tableOutput("filteredtest_data1")
                                    #                                     ) # column
                                  )) # fluidRow 

                       )))

Any feedback on resolving this issue is much appreciated.


Solution

  • Your theme is actually working. However, you're using a fluidPage so you won't necessarily see the theme elements until you add more components.

    If you want to see it in action more clearly you can use a navbarPage

    library(shiny)
    library(shinythemes)
    
    shinyApp(ui  = navbarPage(theme=shinytheme("united"),
                                                 title = 'Research Productivity',
                                                 tabsetPanel(
                                                    tabPanel("Test",
                                                            fluidRow(
                                                                column(width = 2,
                                                                        h4("Functions")),
                                                                        column(width = 12,
                                                                        actionButton(inputId = "btn", label = "button"))
                                                                     )
                                                                ) # fluidRow 
    
                                                 )
    ),
    
    server = function(input, output){ }
    )
    

    enter image description here