如何在R Shiny App中调整小部件的高度?

时间:2014-08-15 08:29:03

标签: r shiny

我目前正在创建一个包含以下代码的小部件:

selectInput("City", label = h5("City"), 
choices = list("Miami","San Francisco", "Chicago" ,
"New York","Los Angeles" ), selected = 1)

我知道selectInput有一个宽度参数:http://shiny.rstudio.com/reference/shiny/latest/selectInput.html

但我对如何调整小部件的高度感到困惑。

1 个答案:

答案 0 :(得分:4)

您可以使用CSS定位选择控件并调整高度:

runApp(list(
  ui = bootstrapPage(
    numericInput('n', 'Number of obs', 100),
    selectInput("City", label = h5("City"), 
                choices = list("Miami","San Francisco", "Chicago" ,
                               "New York","Los Angeles" ), selected = 1),
    plotOutput('plot'),
    tags$head(
      tags$style(
        ".selectize-dropdown, .selectize-input, .selectize-input { 
           line-height: 54px; 
          }"
      )
    )
  ),
  server = function(input, output) {
    output$plot <- renderPlot({ hist(runif(input$n)) })
  }
))

enter image description here