How to style an single individual selectInput menu in R Shiny?

后端 未结 3 721
独厮守ぢ
独厮守ぢ 2020-12-31 14:50

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 t

3条回答
  •  长发绾君心
    2020-12-31 15:25

    Wrap your selectInput in a div:

    tags$div(id='my_div',
             class='my_class',
             selectInput("choice",
                         "choices",
                          c("A", "B", "C"))),
    

    Then you can style it without affecting other selectInput elements:

    #my_div .selectize-dropdown-content > .option {
       background-color: grey;
    }
    

    or

    .my_class .selectize-dropdown-content > .option {
       background-color: grey;
    }
    

    As always with CSS, use id to name and to catch a single element, and class to style multiple elements.

提交回复
热议问题