Create a toggle button or `actionButton()` in the navbar of the main header of a shiny dashboard that will hide and display the left sidebar

Viewed 17

Create a toggle button (except of the existing one which I disabled) or an actionButton() in the navbar of the main header of a shiny dashboard that will hide and display the left sidebar.

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

ui <- dashboardPage(
  dashboardHeader(title = "dashboard"
#actionButton("act","",icon = icon("calendar"))
  ),
  dashboardSidebar(),
  dashboardBody(
    useShinyjs(),
    tags$script("document.getElementsByClassName('sidebar-toggle')[0].style.visibility = 'hidden';"),
    
    
  ),

)

server <- function(input, output) {
  
}

shinyApp(ui = ui, server = server)
0 Answers
Related