ui <- fluidPage(
radioButtons("dist", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp")))
server <- function(input, output) {}
我希望“正常”和“统一”的字体颜色与其他选择的字体颜色不同。假设前两个选择的颜色应该是红色。
谁能做到这一点?
只需看一下中的示例即可?radioButtons
。这将为您提供如何申请的说明HTML
标签到选择。
总而言之,您必须使用参数choiceNames
and choiceValues
.
-
choiceNames
定义单选按钮的用户界面。您可以使用HTML
tags (tags$strong
, tags$code
, ... 和HTML("some html string")
)
-
choiceValues
是服务器将通过以下方式接收的值input$dist
.
这是一个例子:
library(shiny)
shinyApp(
fluidPage(
radioButtons(
inputId = "dist",
label = "Distribution type:",
choiceNames = list(
HTML("<font color='red'>Normal</font>"),
tags$span(style = "color:red", "Uniform"),
"Log-normal", "Exponential"
),
choiceValues = c("norm", "unif", "lnorm", "exp")
)
),
server = function(...) {}
)
另外,看看shinyWidgets::shinyWidgetsGallery()
如果您需要设计灵感radioButton
s.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)