Overflow Scroll for shinydashboard sidebar

shinydashboard

#1

I created a shiny app that has an attached sidebar in it which I would like to add an overflow scroll to. I’ve tried the following two solutions and either didn’t implement them correctly or they just didn’t work:

StackOverflow suggested that I implement this into my code (Not my posted question but found through Google)

shinyDashboard(
  tags$head(
    tags$style(HTML(.sidebar {
                      height: 90vh; overflow-y: auto;
                    }"
               ) # close HTML
    )            # close tags$style
 ),             # close tags#Head

and a question I found on GitHub suggested:

dashboardSidebar(width = 600, div(style="overflow-y: scroll"),...

Any additional thoughts???


#2

can you try placing the whole tags$head as per the below example in your dashboard body?

dashboardBody(
      tags$head( tags$script(type="text/javascript",'$(document).ready(function(){
                             $(".main-sidebar").css("height","100%");
                             $(".main-sidebar .sidebar").css({"position":"relative","max-height": "100%","overflow": "auto"})
                             })')),

      tabItems(
      )
)

Kind regards,
Peter


#3

I’ll try that when I get back to work on Monday, thanks!