在 checkboxGroupInput 中指定行之间的填充

Specify the padding between rows in a checkboxGroupInput

这是我闪亮的应用程序:

ui.R

# values to show, or not show, these will be the 'choices' and 'selected' values
# for the checkboxGroupInput()
all_rows <- 1:25
names(all_rows) <- paste("Row", all_rows)

# data control: the checkboxes will control the data values plotted
controls <-
  list(h3("Multicolumn checkboxGroupInput"), 
       tags$div(align = 'left',
                class = 'multicol',
                checkboxGroupInput(inputId  = 'numSelector',
                                   label    = NULL,
                                   choices  = all_rows,
                                   selected = NULL,
                                   inline   = FALSE))
       ) 


ui <- fluidPage(
                tags$style(type='text/css',"
                label {font-size: 10px; }           
                .form-group {margin-top: 5px; margin-bottom: 5px;}
                .nav-tabs {font-family:'arial';font-size:20px}
                input[type=checkbox] {transform: scale(1);margin-top:1px;}
                .multicol {height: 150px; 
                          -webkit-column-count: 5; /* Chrome, Safari, Opera */
                          -moz-column-count: 5;    /* Firefox */
                          column-count: 5; 
                          -moz-column-fill: auto;
                          -column-fill: auto;}
                .btn {display:block;height: 60px;width: 40px;border-radius: 50%;} 
                #modules .checkbox label span {font-weight:bold;}
                #label {color:#fff;}
                "),                
                fluidRow(column(width = 12, controls),
                         column(width = 12, plotOutput("plot")))
                 # sidebarLayout(
                 #   position = "left",
                 #   sidebarPanel(controls),
                 #   mainPanel()
                 # )                
                )

server.R

server = function(input, output) { 
}

这是它的样子:

我将包括 100 多个带有大标签的复选框,并且我需要删除行之间的空格(黄色空格)。你能建议改变什么吗?

谢谢

只需将 .checkbox, .radio {margin: 0px} 添加到您的 tags$style:

tags$style(
    type = 'text/css',
    "label {font-size: 10px; }
    .form-group {margin-top: 5px; margin-bottom: 5px;}
    .nav-tabs {font-family:'arial';font-size:20px}
    input[type=checkbox] {transform: scale(1);margin-top:1px;}
    .multicol {
      height: 150px; 
      -webkit-column-count: 5; /* Chrome, Safari, Opera */
      -moz-column-count: 5;    /* Firefox */
      column-count: 5; 
      -moz-column-fill: auto;
      -column-fill: auto;
    }
    .btn {display:block;height: 60px;width: 40px;border-radius: 50%;} 
    #modules .checkbox label span {font-weight:bold;}
    #label {color:#fff;}
    .checkbox, .radio {margin: 0px}
    "
  )