简体   繁体   中英

How to wrap the output of checkboxGroupInput?

How to modify the following code so that the options of 'checkboxGroupInput' wrap within '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)

If you want to select all children of the checkboxGroupInput use this selector #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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM