Make Shinydashboard sidebar fixed

Below is a screenshot of my shiny dashboard. I'd like the sidebar (where there is a search function) to be fixed such that when a user clicks on the three horizontal lines, It doesn't collapse.

Hi there, one way to do this is to hide that sidebar toggle using CSS. You can leverage shinyjs to put the necessary code within the app if you don't have/want to make a separate stylesheet:

shinyApp(
  ui = 
    dashboardPage(skin = "yellow",
      dashboardHeader(title = "Data Dashboard"),
      dashboardSidebar(sidebarSearchForm(textId = "search_bar", buttonId = "search_btn", label = "Search Town",
                                         icon = shiny::icon("search"))),
      dashboardBody(
        shinyjs::useShinyjs(),
        shinyjs::inlineCSS("body > div > header > nav > a {visibility: hidden}")
      )
    ),
  server = function(input, output) {
    
  }
)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.