【发布时间】:2021-08-26 00:21:48
【问题描述】:
【问题讨论】:
【问题讨论】:
无需使用pickerInput()。这有效:
library(shiny)
css <- "
.selectize-item {
color: black;
}
.selectize-option {
color: black;
}
.selectize-option:hover {
background-color: #337AB7;
color: white
}
"
render <- I("
{
item: function(item, escape) {
return '<div class=\"item selectize-item\">' + escape(item.label) + '</div>';
},
option: function(item, escape) {
return '<div class=\"option selectize-option\">' + escape(item.label) + '</div>';
}
}")
shinyApp(
ui = fluidPage(
tags$head(tags$style(HTML(css))),
selectizeInput(
"input",
"Choose",
choices = c("a", "b", "c"),
options = list(render = render)
)
),
server = function(input, output) {
}
)
【讨论】:
【讨论】:
pickerInput,那么添加一些 css 可能有助于使用 selectInput 为所选选项着色。