0

In my shinydashboard below Im tryin to change the color of my sidebar and my controlbar to grey but it seems not to work when I combine bs4Dash package. Also my controlBar does not open,

## app.R ##
library(shiny)
library(shinydashboard)

library(bs4Dash)


ui <- dashboardPage(
  dashboardHeader(
    titleWidth = 0,
    controlbarIcon = shiny::icon("filter")
    
  ),
  dashboardSidebar(
    collapsed = TRUE,
    
      
    ),
  dashboardBody(

    tags$head(tags$style(HTML('
        /* logo */
        .skin-blue .main-header .logo {
                              background-color: white;
                              }

        /* logo when hovered */
        .skin-blue .main-header .logo:hover {
                              background-color: white;
                              }

        /* navbar (rest of the header) */
        .skin-blue .main-header .navbar {
                              background-color: white;
        }  
                               
        /* body */
        .content-wrapper, .right-side {
                              background-color: white;
                                 }

        /* main sidebar */
        .skin-blue .main-sidebar {
                              background-color: grey;
        }
        /* toggle button when hovered  */                    
         .skin-blue .main-header .navbar .sidebar-toggle{
                              background-color: black;
         }
        /* toggle button when hovered  */                    
         .skin-blue .main-header .navbar .sidebar-toggle:hover{
                              background-color: black;
                              }
                              
       

        
       
                              ')))
    
  ),
  
  controlbar = dashboardControlbar(id = "dashboardControlbarID", collapsed = TRUE,skin = "grey",icon = icon("filter"))

                                   
)
  

server <- function(input, output) {
  
}

shinyApp(ui, server)
firmo23
  • 7,490
  • 2
  • 38
  • 114

1 Answers1

2

While it is possible to get the grey color for the main sidebar ("left sidebar") I am not sure if this is possible with the controlbar ("right sidebar"), here you can toggle the appearance with skin. After many try and errors I come to the end to use skinSelector().

Beside even after getting the desired color it interferes with hovering effects with strange behaviour.

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
    controlbar = dashboardControlbar(collapsed = FALSE, skinSelector()),
    title = "Skin Selector"
  ),
  server = function(input, output) { }
)

enter image description here

Together with this site How to change the background color of the Shiny Dashboard Body which I suppose you already know, you may come to the conclusion to invest some time to https://rinterface.github.io/shinydashboardPlus/articles/more-skins.html

TarJae
  • 72,363
  • 6
  • 19
  • 66