如何在shinyApp中的常规按钮和actionButton之间添加填充?

时间:2019-01-22 15:36:54

标签: html css r shiny

我的闪亮应用程序中有2个单独的(样式不同)按钮,不幸的是它们之间没有垂直填充。其中一个是简单的HTML按钮,另一个是闪亮的 actionButton

我尝试使用tags$style,但认为我没有正确使用它。我相关部分的代码是

HTML('<button data-toggle="collapse" data-target="#addtools">Additional tools</button>'),
                                                             tags$div(id = 'addtools',  class="collapse",
                                                                      checkboxInput("cluster", "Cluster customers", value = TRUE),
                                                                      checkboxInput("circle", "Add circles", value = FALSE),
                                                                      conditionalPanel("input.circle",
                                                                                       selectInput("sizes", "Radius:", 
                                                                                                   c("5 miles" = "5",
                                                                                                     "10 miles" = "10",
                                                                                                     "20 miles" = "20"))
                                                                      )
                                                             ),
actionButton("runfilters", label = "Apply filters")

此文件的整个UI部分是:

tabPanel("Map",
                          div(class="outer",

                              tags$head(
                                includeCSS("styles.css"),
                                includeScript("gomap.js")
                              ),

                              leafletOutput(outputId = "map", width = "100%", height = "100%"),

                              absolutePanel(id = "controls", class = "panel panel-default", fixed = TRUE,
                                            draggable = TRUE, top = 60, left = "auto", right = 20, bottom = "auto",
                                            width = 330, height = "auto",

                                            h2("Select your filters:"),

                                            selectInput("level",
                                                        "Detail level:",
                                                        c("Customer level", "County level"),
                                                        selected = "County level"),

                                            selectInput("mapstates","States:", c("All states"="",
                                                                                 structure(state.abb, names=state.name),
                                                                                 "Washington, DC"="DC"),
                                                        multiple = TRUE
                                            ),
                                            conditionalPanel("input.mapstates",
                                                             selectInput("mapcounties", "Counties", c("All counties"=""),
                                                                         multiple = TRUE
                                                             )
                                            ),

                                            radioButtons("retailcorrection","Customer ownership:",
                                                         c("Private",
                                                           "Public"),
                                                         selected = "Private",
                                                         inline = TRUE),

                                            conditionalPanel("input.level == 'Customer level'",

                                                             selectInput("var", 
                                                                         label = "Customer type:",
                                                                         choices = c("ALL",
                                                                                     "ESSENTIAL", 
                                                                                     "NON-ESSENTIAL"),
                                                                         selected = "ALL"
                                                             ),
                                                             radioButtons("custoporoh","Widget Category:",
                                                                          c("Widget A",
                                                                            "Widget B"),
                                                                          selected = "Widget A",
                                                                          inline = TRUE),
                                                             conditionalPanel("input.custoporoh == 'Widget A'",
                                                                              numericInput("oprange", 
                                                                                           label = "Minimum average monthly Widget A ordering (in dosage units):",
                                                                                           min = 0, max = 1000000, value = 0
                                                                              ),
                                                                              numericInput("opprange",
                                                                                           label = "Minimum average monthly Widget A ordering as a percentage of total ordering:",
                                                                                           min = -1, max = 1, value = -1
                                                                              )
                                                             ),
                                                             conditionalPanel("input.custoporoh == 'Widget B'",
                                                                              numericInput("ohrange","Minimum average monthly Widget B ordering (in dosage units):",
                                                                                           min = 0, max = 1000000, value = 0
                                                                              ),
                                                                              numericInput("ohprange",
                                                                                           label = "Minimum average monthly Widget B ordering as a percentage of total ordering:",
                                                                                           min = -1, max = 1, value = -1
                                                                              )
                                                             ),

                                                             HTML('<button data-toggle="collapse" data-target="#addtools">Additional tools</button>'),
                                                             tags$div(id = 'addtools',  class="collapse",
                                                                      checkboxInput("cluster", "Cluster customers", value = TRUE),
                                                                      checkboxInput("circle", "Add circles", value = FALSE),
                                                                      conditionalPanel("input.circle",
                                                                                       selectInput("sizes", "Radius:", 
                                                                                                   c("5 miles" = "5",
                                                                                                     "10 miles" = "10",
                                                                                                     "20 miles" = "20"))
                                                                      )
                                                             )
                                            ),


                                            conditionalPanel("input.level == 'County level'",

                                                             selectInput("countyvar", 
                                                                         label = "Customer type:",
                                                                         choices = c("ALL",
                                                                                     "ESSENTIAL"),
                                                                         selected = "ALL"
                                                             ),

                                                             selectInput("year", "Year:",
                                                                         choices = c("2006","2007","2008","2009","2010","2011", "2012",
                                                                                     "2013","2014","2015","2016","2017","2018", "All years" = "2019"),
                                                                         selected = "2019"
                                                             ),
                                                             radioButtons("oporoh","Widget Category:",
                                                                          c("Widget A",
                                                                            "Widget B"),
                                                                          selected = "Widget A",
                                                                          inline = TRUE),

                                                             conditionalPanel("input.oporoh == 'Widget A'",
                                                                              numericInput("opppcrange",
                                                                                           label = HTML("Minimum Widget A units per adult per month:"),
                                                                                           min = 0, max = 160, value = 0
                                                                              ),
                                                                              numericInput("opcrange", 
                                                                                           label = "Minimum average monthly Widget A ordering (in dosage units):",
                                                                                           min = 0, max = 10000000, value = 0
                                                                              ),
                                                                              numericInput("oppcrange",
                                                                                           label = "Minimum average monthly Widget A ordering as a percentage of total ordering:",
                                                                                           min = -1, max = 1, value = -1
                                                                              )
                                                             ),
                                                             conditionalPanel("input.oporoh == 'Widget B'",
                                                                              numericInput("ohppcrange",
                                                                                           label = "Minimum Widget B units per adult per month:",
                                                                                           min = 0, max = 160, value = 0
                                                                              ),
                                                                              numericInput("ohcrange","Minimum average monthly Widget B ordering (in dosage units):",
                                                                                           min = 0, max = 10000000, value = 0
                                                                              ),
                                                                              numericInput("ohpcrange",
                                                                                           label = "Minimum average monthly Widget B ordering as a percentage of total ordering:",
                                                                                           min = -1, max = 1, value = -1
                                                                              )
                                                             )
                                            ),

                                            actionButton("runfilters", label = "Apply filters")
                              )
                          )
                 )

我尝试实施

HTML('<button data-toggle="collapse" data-target="#addtools">Additional tools</button>'),                                                                
tags$div(id = 'addtools',  class="collapse", tags$style = "padding=10px"

但是这似乎不起作用。任何帮助将不胜感激。

0 个答案:

没有答案