Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R/Shiny selectInput widget size

I want to change the size of the selectInput() widget in shiny. I know it is based on selectize.js, so I have tried modifying every single attribute on this page (https://github.com/selectize/selectize.js/blob/master/dist/css/selectize.css)

and can't figure out which one controls the height. But I don't know CSS or javascript. Any suggestions?

Minimal example:

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)

produces:

enter image description here

like image 994
Lee88 Avatar asked Feb 28 '18 05:02

Lee88


1 Answers

try this and have fun:

    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)
like image 55
Mahdi Baghbanzadeh Avatar answered Nov 16 '22 04:11

Mahdi Baghbanzadeh