css - Shiny 的 selectInput 标签 CSS

标签 css shiny

我正在创建带有蓝色标题的白色 div,但是当我将 selectInput 放入 div 时,我想要蓝色的标题是 selectInput 标签。

enter image description here

如何编辑下面用于创建我的 block 的代码,以便 TO_BLUE 框具有与 BLUE block 相同的样式?

library(shiny)

# I have two blocks BLUE and TO_BLUE
blocks <- c("BLUE", "TO_BLUE")

BLOCK <- function(data, name)
{
  # create a white div with rounded edges
  # the title of the div will have a blue background
  div(style = "
      text-align: center;
      font-size: 12px;
      background-color: white;
      border-radius: 10px;
      color: black;
      margin-bottom: 15px;
      min-height: 55px;
      ",
      id = name,

      if (name == "BLUE") {
        # this div gives the "BLUE" block it's blue background
        div(style = "background-color: #0c283b;
            color: white;
            border-top-left-radius: 10px;
            border-top-right-radius: 10px;
            min-width: 70px;",
            name)
      } else {
        # but how do I get the TITLE within the selectInput to be blue like the block above?
        selectInput(name, "TO_BLUE", choices = c("1", "2", "3", selectize = FALSE))
      }

  )
}

ui <- fluidPage(


   sidebarLayout(
      sidebarPanel(
        lapply(blocks, BLOCK, data = blocks)
      ),

      mainPanel()
   )
)

server <- function(input, output) {
}

shinyApp(ui = ui, server = server)

最佳答案

使用 shinyjs 我添加了

inlineCSS(".control-label { 
            background-color: #0c283b; 
            width: 100%; 
            color: white;
            border-top-left-radius: 10px;
            border-top-right-radius: 10px;
            }")

关于css - Shiny 的 selectInput 标签 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59758441/

相关文章:

shiny - 下载 DT 中的选定行

负载均衡器后面的 R-Shiny 脚本超时

css - 如何使登录和注册向右浮动

javascript - block 上的jquery过渡效果

css - 尽管内联 block ,2 个子 div,第二个子 div 进入新行

r - 在 Shinyapps.io 中部署 R 应用程序 - 错误 : HTTP 404

css - 在 R Shiny 中旋转 react 物的 header

r - R中的 map ,如何绘制巴尔的摩 map ?

javascript - 如果元素溢出应用动态滚动

html - 数据表 Bootstrap 对齐旋转标题