4

Is it possible to add a horizontal scroll bar to a selectInput with a fixed number of items (e.g. size = 5)?

Some items are too long and will not show completely, and I don't want to change the width of the selectInput.

I tried adding it with:

tags$head(tags$style(HTML('.shiny-bound-input{overflow-x: scroll;}')))

but without success... Is there any solution?

library(shiny) 
u <- fluidPage(   

  tags$head(tags$style(HTML('.shiny-bound-input{overflow-x: scroll;}'))),

  selectInput(inputId = "in", label = "Choose", choices = c('Short','A very short sentence.'), 
              selectize = F, size = 5, width = "150px")

)

s <- function(input,output){} 

shinyApp(ui=u,server=s)

Edit: It seems to be browser dependent. E.g. in Opera and Chrome is a horizontal bar. In Firefox and IE not.

wati
  • 310
  • 2
  • 11

0 Answers0