css - 如何包装 checkboxGroupInput 的输出?

标签 css r shiny

如何修改以下代码,使 'checkboxGroupInput' 的选项包含在 'width: 200px' 内?

library(shiny)

ui <- fluidPage(
  tags$style("
      .custom-wrap {
        display: flex;
        flex-flow: wrap;
        flex-direction: column;
        width: 200px;
      }
      "
  ),
  div(class = "custom-wrap",checkboxGroupInput("variable", "Variables to show:",
                                    c("Cylinders" = "cyl",
                                      "Transmission" = "am",
                                      "Gears" = "gear")))
)

server <- function(input, output, session) {

}

shinyApp(ui, server)

最佳答案

如果您想选择 checkboxGroupInput 的所有子项,请使用此选择器 #variable *:

library(shiny)

ui <- fluidPage(
  tags$style("
      #variable * {
        display: flex;
        flex-flow: wrap;
        flex-direction: column;
        width: 200px;
      }
      "
  ),
  checkboxGroupInput("variable", "Variables to show:",
                     c("Cylinders" = "cyl",
                       "Transmission" = "am",
                       "Gears" = "gear")))

server <- function(input, output, session) {

}

shinyApp(ui, server)

关于css - 如何包装 checkboxGroupInput 的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54322922/

相关文章:

javascript - 将事件类添加到下一个 sibling

css - 调试拨动开关 css?

javascript - 使用 jquery 为 div 分配样式

r - 将文档术语矩阵 (DTM) 转换为数据帧(R 编程)

r - Ubuntu 在 R 中删除 .libPaths()

r - 将新变量(列)快速添加到 Shiny 中的响应式(Reactive)数据框

html - 在同一水平线上对齐两个 div 不起作用

r - 系数约束的线性回归

r - 如何在shiny app中播放本地视频?(Windows)

r - 拆分布局中元素大小动态调整到浏览器窗口