rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
893 stars 300 forks source link

Long elements spill beyond sidebar #112

Open thecomeonman opened 8 years ago

thecomeonman commented 8 years ago

I didn't receive a response here - http://stackoverflow.com/questions/34336079/shinydashboard-sidebar-menu-overflow so posting it as an issue.

There seems to be no way to enforce word wrap on the sidebar through the R code itself. It might be possible by editing the underlying CSS itself but trying to change CSS for just that menu item through R itself seems to have no effect.

ui <- dashboardPage(
   dashboardHeader(
      title = "Sidebar spill"

   ),
   dashboardSidebar(
      sidebarMenu(
         menuItem(text = "sfsdf sfaosh oas fwue wi aseiu wehw wuer woeur owuer  ")
         )
      ),
   dashboardBody(
      fluidRow(

      )
   )
)

server <- function(input, output) {

}

shinyApp(ui, server)
}
GitChub commented 8 years ago

I just ran into this issue myself and also saw your question on stackoverflow. If I find a decent solution, I'll be sure to share it.

GitChub commented 8 years ago

The file "AdminLTE.min.css" (this version of it anyway) specifies "white-space: nowrap !important" for the "sidebar-menu" class as well as "li" elements with class "header" that are direct descendents of elements with the "sidebar-menu" class. The "li" elements in the sidebar menu of my Shinydashboard application do not have the "header" class, so I overrode "white-space: nowrap !important" (that was being applied because the "ul" element containing the menu is of class "sidebar-menu") by adding the following CSS to a custom CSS file:

.sidebar-menu > li { white-space: normal; }

thecomeonman commented 8 years ago

Thanks, I'll try it out. Although I still think this merits a solution which doesn't involve having to play with anything else apart from the R code.

pepijn-devries commented 3 years ago

If you don't wan't to mess with CSS code, this is what worked for me in R: to the sidebarMenu-function add the following argument: style = "white-space: normal;". This effectively does the same thing as adding it to the css...