簡體   English   中英

如何在Shiny中為selectInput占位符提示着色?

[英]How to color selectInput placeholder prompt in Shiny?

我想在SelectInput框(Segment mIgration)中SelectInput藍色的“ Choose”提示,以便它看起來與其他輸入框相似,但是失敗了。 在此處輸入圖片說明

這是我在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
                   ))

這段代碼將左側兩個輸入框中的選定元素顯示為藍色

  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)

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM