着色checkboxGroupInput选择 [英] Coloring the checkboxGroupInput choices
本文介绍了着色checkboxGroupInput选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Shiny UI中,
In my Shiny UI I have
ui <- checkboxGroupInput("my_cbgi", "Choose Something", c("A", "B", "C", "D"))
我想因此,选项(文本)A和B被涂成红色,而C和D没有被涂成红色。我尝试了HTML,但随后在UI中出现了 attribs和 children之类的奇怪框。
And I would like it so that the choices (the text) A and B are colored red, but C and D are not. I tried HTML but then in the UI weird boxes like "attribs" and "children" showed up.
预先感谢
推荐答案
由于 shiny_1.0.1
, checkboxGroupInput
具有 choiceNames
和 choiceValues
参数用于传递任意UI以显示给用户,请查看以下示例:
Since shiny_1.0.1
, checkboxGroupInput
have a choiceNames
and choiceValues
arguments for passing arbitrary UI to display to the user, check this example :
library("shiny")
ui <- fluidPage(
checkboxGroupInput(
inputId = "my_cbgi",
label = "Choose Something",
choiceNames = list(
tags$span("A", style = "color: red;"),
tags$span("B", style = "color: red;"),
tags$span("C", style = "color: blue;"),
tags$span("D", style = "font-weight: bold;")
),
choiceValues = c("A", "B", "C", "D")
)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
这篇关于着色checkboxGroupInput选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文