Search code examples
rshinydashboardbs4dash

How to Disable Shiny bs4Dash Dashboard controlbar (Right Sidebar)


What is the parameter to control the right side bar on a Shiny bs4Dash dashboard. My reading of the dashboardControlbar function at https://rinterface.github.io/bs4Dash/articles/step-by-step.html, which I understand to be the sidebar to the right of the page, is to set disable = T, in a similar way to how the dashboardSidebar(disable = T) controls the appearance sidebar to the left.

I have set controlbar = dashboardControlbar(disable = T) however on the Shiny App below and the right sidebar still opens when pressing the button at the top. Thanks for any suggestions in advance.

Edit (in response to dashboardHeader comment ): This question is in reference to bs4Dash V2.0.0 available via github. https://github.com/RinteRface/bs4Dash Please note that the github page also recommends github versions of htmltools and shiny.

library(shiny)
library(bs4Dash)


ui = dashboardPage(
  header = dashboardHeader(),
  sidebar = dashboardSidebar(
    disable = T
    ),
  body = dashboardBody(),
  controlbar = dashboardControlbar(
    disable = T
  ),
  title = ""
)

server <- function(input, output, session) {}
shinyApp(ui, server)

Solution

  • You can remove controlbar argument to disable it.

    library(shiny)
    library(bs4Dash)
    
    
    ui = dashboardPage(
      header = dashboardHeader(),
      sidebar = dashboardSidebar(
        disable = T
      ),
      body = dashboardBody(),
      title = ""
    )
    
    server <- function(input, output, session) {}
    shinyApp(ui, server)