TheComeOnMan
TheComeOnMan

Reputation: 12885

shinydashboard Sidebar Menu Overflow

Is there any way to fit some sort of text on shinydashboard with word wrap? The default behaviour seems to be for it to spill over into the body area.

I would like to avoid modifying css directly however if there is a workaround which involves modifying CSS as part of the server / ui code itself then I'm open to that.

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

Upvotes: 7

Views: 1703

Answers (2)

Nah
Nah

Reputation: 41

The file "AdminLTE.min.css" (this version of it anyway in this version of Shinydashboard) 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. I saw that 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;
}

Upvotes: 4

MLavoie
MLavoie

Reputation: 9836

what about something like this

...
  dashboardSidebar(
    sidebarMenu(
      tags$div(class="header", checked=NA,
               tags$p("sfsdf sfaosh oas fwue", tags$br(), "wi aseiu wehw wuer woeur owuer")
      )
    )
  ),
...

Upvotes: 0

Related Questions