gpt4 book ai didi

css - 如何在 Shiny 中为 selectInput 占位符提示着色?

转载 作者:太空宇宙 更新时间:2023-11-04 06:24:39 24 4
gpt4 key购买 nike

我想在 SelectInput 框(Segment mIgration)中制作蓝色的“选择”提示,使其看起来与其他输入框相似但失败了。 enter image description here

这是我在 UI 部分使用的代码片段:

  column(width=2,
selectInput(inputId = "SEG_MIG",
label = "Segment Migration",
choices =c("Choose"='', "ALL",
unique(sort(as.character(final_data$`SEG MIG`)))),
multiple = TRUE
))

左边两个inputbox中的选中元素被这段代码染成了蓝色

  tags$style(type='text/css', ".selectize-input { font-size: 16px; line-height: 16px; color: blue;} 
.selectize-dropdown { background: grey; color: white; font-size: 12px; line-height: 12px; }"),

我不确定我错过了什么。任何建议将不胜感激。

最佳答案

这是控制选项、元素和占位符样式的 CSS。

library(shiny)

css <- "
.selectize-dropdown-content .option {
color: blue;
}
.selectize-input .item {
color: red !important;
background-color: yellow !important;
}
::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: pink;
}
::-moz-placeholder { /* Firefox 19+ */
color: pink;
}
:-ms-input-placeholder { /* IE 10+ */
color: pink;
}
:-moz-placeholder { /* Firefox 18- */
color: pink;
}"

ui <- fluidPage(
tags$head(
tags$style(HTML(css))
),
column(width=2,
selectInput(inputId = "SEG_MIG",
label = "Segment Migration",
choices = c("Choose"='', "ALL", "AAA", "BBB"),
multiple = TRUE
)
)
)

server <- function(input, output) {}

shinyApp(ui, server)

enter image description here

关于css - 如何在 Shiny 中为 selectInput 占位符提示着色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55186148/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com