pythonlearner
pythonlearner

Reputation: 31

Change height of navbarPage

I am trying to shrink the size of the navigation bar in shiny R. However, even if I change the header size (h3 to h6), the height of the navbarPage stays the same, making it look too big. I have not been successful in decreasing its size, any help would be appreciated!

This is what it looks like:

See here

The code I have currently is below:

shinyUI(fluidPage( 
 tags$head(
  tags$style(HTML(".leaflet-container { background: #B6D0CE; }"))),
 fluidRow(h3("[Title] Dataset", align = "center", 
         style="padding:10px;")),
 fluidRow(navbarPage(theme = shinytheme("paper"), h6("Menu"),
          collapsible=TRUE, tabPanel(h6("Tab 2"))))
))

Upvotes: 2

Views: 1138

Answers (1)

SBista
SBista

Reputation: 7694

You can decrease the height of navbar using the following code in you app:

tags$head(
    tags$style(HTML(' .navbar {
                          height: 25px;
                          min-height:25px !important;
                        }
                      .navbar-nav > li > a, .navbar-brand {
                            padding-top:1px !important; 
                            padding-bottom:1px !important;
                            height: 25px;
                            }')))

Adding this code snippet to your code will result the following: enter image description here

Hope it helps!

Upvotes: 2

Related Questions