在selectInput中添加水平滚动条

时间:2019-04-04 20:26:42

标签: r shiny horizontal-scrolling selectinput

是否可以将水平滚动条添加到具有固定数量项(例如size = 5)的selectInput上?

某些项目太长,无法完全显示,我不想更改selectInput的宽度。

我尝试添加:

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

但没有成功... 有什么解决办法吗?

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)

0 个答案:

没有答案