R / Shiny selectInput小部件大小

时间:2018-02-28 05:50:25

标签: javascript css r shiny

我想在shine中更改selectInput()小部件的大小。我知道它基于selectize.js,所以我尝试修改此页面上的每个属性(https://github.com/selectize/selectize.js/blob/master/dist/css/selectize.css

并且无法确定哪一个控制高度。但我不知道CSS或javascript。有什么建议吗?

最小例子:

library(shiny)

ui <- fluidPage(
    fluidRow(
        actionButton('play_but', 'Play', style='height: 20px; font-size: 10px; padding: 1px 1px;'),
        actionButton('pause_but', 'Pause', style='height: 20px; font-size: 10px; padding: 1px 1px;'),
        selectInput("speed", label=NULL, choices = list("1" = 1, "2" = 2), selected = 1),
        tags$head(tags$style(HTML(".selectize-input {max-height: 5px !important; font-size: 10px; padding: 1px 1px; box-sizing: content-box;}"))),
        tags$head(tags$style(HTML(".selectize-input input {line-height: 10px;}"))),
        tags$head(tags$style(HTML(".selectize-dropdown-content {font-size: 10px; }")))
        )
    )

shinyApp(ui, server)

产生

enter image description here

1 个答案:

答案 0 :(得分:1)

试试这个并玩得开心:

    library(shiny)

    ui <- fluidPage(
      fluidRow(

        selectInput("speed", label=NULL, choices = list("1" = 1, "2" = 2), selected = 1),
        tags$head(tags$style(HTML(".selectize-input {height: 100px; width: 500px; font-size: 100px;}")))
      )

)
server <- function(input, output){}
shinyApp(ui, server)