我找到了一个类似的question,但在以原生形式处理Shiny中的这个Radio Buttons时没有解决这个问题;即没有HTML。
我有这一行:
column(6, h1(radioButtons(inputId="gender", "Gender", choices = list("combined" = "combined", "male only" = "male", "female only" = "female"), inline=TRUE)))
看起来像这样:
我想制作标签(例如,'组合','仅限男性','仅限女性')加粗。
我尝试设置一个类class="radioSelect
,如下所示:
column(6, h1(radioButtons(inputId="gender", "Gender", choices = list(class="radioSelect", combined" = "combined", "male only" = "male", "female only" = "female"), inline=TRUE)))
...但最终,有趣且毫不奇怪,这个:
有没有人对如何将这个类应用于Shiny单选按钮上的标签有任何建议?谢谢你的关注。
答案 0 :(得分:2)
我最后更改了R代码以放入一个名为 radioSelect 的类:
column(6, h1(class="radioSelect", radioButtons(inputId="gender", "Gender", choices = list(...
然后在CSS文件中,我访问了标签:
.radioSelect label.radio { ...
这很有效,因为标签上都有“无线电”类。因此,我现在可以控制标签。
答案 1 :(得分:1)
<div class="thisForm">
column(6, h1(radioButtons(inputId="gender", "Gender", choices = list(class="radioSelect", combined" = "combined", "male only" = "male", "female only" = "female"), inline=TRUE)))
</div>
CSS
.thisForm{
font-weight: bold;
}
至少,这就是他们在文档中的表现:http://shiny.rstudio.com/reference/shiny/latest/radioButtons.html
答案 2 :(得分:0)
我有一个类似的问题,发现这可以改变整个radioButton输入的风格:
column(6, h1(radioButtons(inputId="gender", "Gender", choices = list(...)), style = "font-weight:bold;")