Can you apply css style to a single selectInput menu?
I've found code in other articles that deal with styling selectInput menu's but the outcome affects all of them in the app. I would like to just manipulate individual menus. I'm also considering adding style to individual elements based on conditionals happening in the server, but that's for another separate question.
test app code:
library(shiny)
library(shinydashboard)
library(shinyjs)
ui <-
fluidPage(
hr("how do we get the change the style elements of a single select input?)
tags$style(type='text/css', .selectize-input { font-size: 8px; line-height: 8px;}
.selectize-dropdown { font-size: 8px; line-height: 8px; }"),
selectInput("choice", "choices", c("A", "B", "C")),
selectInput("choice2", "choices", c("D", "E", "F"))
)
server < - function(input, output, session) { }
})
shinyApp(ui = ui, server = server)
This approach comes straight from Dean Attali's answer here: examp, and a similar question is asked as final comment, but no answer, so I decided to post a question on the matter since I have the same problem.
for other elements likea textInput field, the way I usually do this is by this:
tags$style(type='text/css', "#NAMEELEMENT {background-color: green; height: 40px; border-color: #bfbfbf; width: 520px; position: relative;left: 3%}"),
where you can attach the tag$style to an element by # and its inputId.
Cheers.