Search code examples
rshinyshinydashboard

Totally delete the toggle button that hides and display sidebar in shiny dashboard


How can I totally delete the toggle button that hides and display sidebar in shiny dashboard?

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

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    collapsed = T
  ),
  dashboardBody(

    
  )
)

server <- function(input, output) { }

shinyApp(ui, server)

Solution

  • library(shiny)
    library(shinydashboard)
    
    css <- ".sidebar-toggle {display: none;}"
    
    ui <- dashboardPage(
      dashboardHeader(),
      dashboardSidebar(
        collapsed = T
      ),
      dashboardBody(
        tags$head(tags$style(HTML(css)))
        
      )
    )
    
    server <- function(input, output) { }
    
    shinyApp(ui, server)