shinydashboard icon indicating copy to clipboard operation
shinydashboard copied to clipboard

Long elements spill beyond sidebar

Open thecomeonman opened this issue 8 years ago • 4 comments

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)
}

thecomeonman avatar Dec 18 '15 11:12 thecomeonman

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 avatar Dec 18 '15 19:12 GitChub

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; }

GitChub avatar Dec 18 '15 20:12 GitChub

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.

thecomeonman avatar Feb 05 '16 02:02 thecomeonman

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...

pepijn-devries avatar May 29 '21 12:05 pepijn-devries