Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Part of dateRangeInput ui gets hidden under the shiny dashboard header

Is there a way to always make the ui of dateRangeInput fully visible? Minimising the window and clicking on the date, this happens:

enter image description here

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Home", tabName = "Home")
    )
  ),
  dashboardBody(
    tabItems(
      tabItem(tabName = "Home",
        fluidRow(
          br(),
          br(),
          br(),
          br(),
          br(),
          br(),
          box(
            dateRangeInput("daterange", "Date range:", start = "2001-01-01", end = "2010-12-31"),
            title="Select Dates", solidHeader=T, status="primary",width=6,height=250)
        )
      )
    )
  )
)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)
like image 606
user270199 Avatar asked Sep 15 '25 00:09

user270199


1 Answers

You can use css to make the z-index of .dropdown-menu more than that of dashboard header using the following tag:

tags$div(tags$style(HTML( ".dropdown-menu{z-index:10000 !important;}")))

In your apps ui it would be as follows:

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Home", tabName = "Home")
    )
  ),
  dashboardBody(

    tags$div(tags$style(HTML( ".dropdown-menu{z-index:10000 !important;}"))),

    tabItems(
      tabItem(tabName = "Home",
              fluidRow(
                br(),
                br(),
                br(),
                br(),
                br(),
                br(),
                box(
                  dateRangeInput("daterange", "Date range:", start = "2001-01-01", end = "2010-12-31"),
                  title="Select Dates", solidHeader=T, status="primary",width=6,height=250)
              )
      )
    )
  )
)

You would get something like this:enter image description here

Hope it helps!

like image 73
SBista Avatar answered Sep 17 '25 14:09

SBista