user2500880
user2500880

Reputation: 125

How to change color of Navbar in Shiny

I am trying to set the background color of a navbar in Shiny to blue. I have tried a modified bootstrap.css which works successfully in HTML on bootstrap's navbar. However, I am unable to change the background color in shiny using the recommended navbarPage("Testing", theme="bootstrap.css", method.

shinyUI(fluidPage(title="Testing", 
  navbarPage("App Title", theme="bootstrap.css",
  tabPanel("Plot"),
  tabPanel("Summary"),
  tabPanel("Table", helpText("Testing"))
)))

I have also tried the following code unsuccessfully tags$style(type = "text/css", ".navbar {background-color: blue;}"). Any advice would be appreciated.

Upvotes: 3

Views: 2917

Answers (1)

user2500880
user2500880

Reputation: 125

The problem was that I was using bootstrap version 3.2.0. I've resolved the issue by using a modified bootstrap.css version 2.3.2. This is consistent with the current RStudio Shiny site which says "Note: The Shiny UI is built with the Bootstrap 2.3.2 HTML/CSS framework. CSS files designed to work with Bootstrap 2.3.2 will work best with Shiny".

Upvotes: 2

Related Questions