Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extend the background in a shiny dashboard

Here is a small (silly) code of a shiny dashboard application:

    library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(uiOutput("choices")),
  dashboardBody()
)

server <- function(input,output) {
  output$choices <- renderUI(radioButtons("blabla", NULL, 1:100))
}

shinyApp(ui = ui, server = server)

When you run this code, you see that if you scroll down, the nice background on the right hand side suddenly switches to black. How do I make sure that the background stays nice and uniform throughout the entire page, even if a scroll down and use ui-elements?

like image 896
mumass Avatar asked Mar 05 '23 17:03

mumass


1 Answers

I know this is an old question, but I'm adding here for posterity. I did not find a fixed height to be satisfactory as it adds a permanent scrollbar.

Using .content-wrapper { overflow: auto; } seems to work as I expect. I.e.:

dashboardPage(
    dashboardHeader(),
    dashboardSidebar(
        # ...
    ),
    dashboardBody(

        # ...

        tags$head(tags$style(HTML('.content-wrapper { overflow: auto; }')))
    )
)
like image 176
Anders Ellern Bilgrau Avatar answered Mar 28 '23 04:03

Anders Ellern Bilgrau