How do I adjust the height of a widget in the R Shiny app?

I am currently creating a widget with the following code:

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

      

I understand that selectInput has a width parameter: http://shiny.rstudio.com/reference/shiny/latest/selectInput.html

but I don't understand how to adjust the height of the widget.

+3


source to share


1 answer


You can use CSS to target the selectize control and adjust the height:

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

+3


source







All Articles