Shiny - change the size (padding?) of dropdown menu (select tags) smaller

前端 未结 1 1310
梦谈多话
梦谈多话 2021-01-15 06:41

How can I change the size of dropdown menu (select tags) smaller? I thought it is the padding that makes the dropdown looking \'thick\'. So I change the padding to 0 to make

相关标签:
1条回答
  • 2021-01-15 06:45

    For the dropdown options, it's line-height that you want (the padding is already 0 by default I think, look at the CSS on it using the chrome debugger).

    For the box itself, it looks like bootstrap is placing a min-height on it, so you also need to add min-height: 0;. Again, I just figured this out right now with the debugger by looking at its CSS.

    So here's a working solution:

    runApp(shinyApp(
      ui = fluidPage(
        tags$style(type='text/css', ".selectize-input { padding: 2px; min-height: 0;} .selectize-dropdown { line-height: 10px; }"),
        selectInput("test","Test", 1:5)
      ),
      server = function(input, output, session) {
      }
    ))
    

    Please try to post complete code samples rather than a snippet of code that we have to complete ourselves. Makes it easier and faster for us to try to answer

    0 讨论(0)
提交回复
热议问题