Adam_G
Adam_G

Reputation: 7879

Change font color in shiny app side panel

How can I modify the font of individual checkbox items in a shiny app? I've tried:

checkboxGroupInput("trendsInput", "Add Trend Lines",
                         choices=c(tags$HTML("<font color='red'>All Typists</font>")="allTypists", 
                                   "All Selected User's Answers"="allThisUser", 
                                   "Same Question"="allQuestion", 
                                   "Same L1"="allL1", 
                                   "Same Cognitive Load"="allCogLoad"
                         ),
                         selected="allTypists")

But this does not compile.

Upvotes: 1

Views: 723

Answers (1)

Xiongbing Jin
Xiongbing Jin

Reputation: 12097

You can do it with Javascript. Just add the code under your checkboxGroupInput (remember to add a ,):

tags$script("$('input[value=\"allTypists\"]').parent().css('color','red');")

The code uses jQuery to find the input with the value of allTypists, and assign the css color:red to its parent (the actual label).

Upvotes: 2

Related Questions