我构建了一个具有多选输入的Shinyapp。一切正常,但当我选择多个值时,
This is the ugly box I'm talking about
有没有一种方法可以格式化所选值的显示?也许只是在带有选项的下拉列表中打勾,或者类似的东西?
发布于 2020-10-26 19:06:39
您可以使用此css更改选择框中项目的颜色
.selectize-control.multi .selectize-input > div {
background: #d8544c;
color: #fdfdfd;
}
示例应用程序的代码:
library(shiny)
ui <- fluidPage(
tags$head(
tags$style(HTML("
.selectize-control.multi .selectize-input > div {
background: #d8544c;
color: #fdfdfd;
}
"))
),
sidebarLayout(
sidebarPanel(
selectInput("select1",
"Choices:",
choices = names(mtcars), multiple = TRUE)
),
mainPanel(
verbatimTextOutput("out")
)
)
)
server <- function(input, output) {
output$out <- renderPrint({
input$select1
})
}
shinyApp(ui = ui, server = server)
https://stackoverflow.com/questions/64542030
复制相似问题