如何修改以下代码,使 '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/