Take a look at this sample shiny app:
library(shiny)
ui <- fluidPage(tags$head(includeCSS("www/mycss.css")),
selectInput("foo", "Choose", width = '20%',
multiple = F, selected = "red1",
choices = list(red = c("red1", "red2"),
green = c("green1", "green2")),
selectize = F))
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
The file mycss.css
is located in a folder named www
and includes the following styles:
#foo optgroup[label = "red"]{
color: #990000;
}
#foo optgroup[label = "green"]{
color: #009900;
}
I intend to further enhance the styling of the selectInput
.
Currently, the hover background color for an item is blue, but I want to set a unique hover color for each group individually.
https://i.sstatic.net/K9SIB.png
I've attempted several options like
#foo optgroup[label = "green"]:hover
without success. Any assistance would be greatly appreciated.