You can use js
to modify tab colors as shown below.
library(shiny)
library(shinydashboard)
library(DT)
js <- ".nav-tabs-custom .nav-tabs li a {background-color: green; color:white;}
.nav-tabs-custom .nav-tabs li.active {border-top-color: #d73925; }
.nav-tabs-custom .nav-tabs li.active a {background-color: black; color:orange; !important;}
"
jsb <- ".nav-tabs-custom .nav-tabs li a[data-value='t1'] {background-color: red; color:white;}
"
jsa <- ".nav-tabs-custom .nav-tabs li a[data-value='t1'] {background-color: blue; color:white;}
"
ui <- dashboardPage(
dashboardHeader(
),
dashboardSidebar(
selectInput(inputId="1", label = "Label1", choices = "variable", "Variable:"),
selectInput(inputId="2", label = "Label2", choices = "variable", "Variable:") ),
dashboardBody(
tags$style(js),
fluidRow(
tabBox(width =10,
tabPanel("t0",h2("normal tab"), uiOutput("tt"),
selectInput(inputId="t0in", label = "Choose: ", choices = c("A","B"))),
tabPanel("t1",uiOutput("tb")),
tabPanel("t2",h2("normal tab")),
tabPanel("t3",h2("normal tab"))
)
)
)
)
server <- function(input, output){
output$tt <- renderUI({
if (input$t0in == "B"){
tags$style(jsb)
}else {tags$style(jsa)}
})
output$table1 <- renderDT(mtcars)
output$plot1 <- renderPlot(plot(cars))
output$tb <- renderUI({
if (input$t0in == "B"){
plotOutput("plot1")
}else {DTOutput("table1")}
})
}
shinyApp(ui, server)