Eric Hung
Eric Hung

Reputation: 522

r - change navbar color in shiny

I was trying to change the color of navbar on top of the page. I've searched many resources but only found how I could change the color on mainPanel. I am totally new to CSS so I have no idea how I can insert the code into my app. Can anyone show me some examples?

This is my Shiny app: navbarPage enter image description here

I'd like to turn it into this: Black color

enter image description here

Cuz my code is too long to be put here. The structure looks like

shinyUI(navbarPage("title1", 
          tabPanel("title2",
            sidebarLayout(
              sidebarPanel(
              )
            )
           )
)

Many thanks in advance.

Upvotes: 3

Views: 4288

Answers (1)

Rorschach
Rorschach

Reputation: 32426

The navbarPage has an inverse argument to change the class to navbar-inverse, so you don't need to mess with the css at all luckily.

library(shiny)
ui <- shinyUI(navbarPage(inverse=TRUE,
  "title1", tabPanel("title2",
  sidebarLayout(sidebarPanel(), mainPanel()))))
server <- function(input, output) {}
shinyApp(ui, server)

Upvotes: 4

Related Questions