R Shiny display checkboxGroupInput horizontally

后端 未结 1 1858
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 10:18

How to display checkboxGroupInput horizontally (inline block) with R shiny?

1条回答
  •  醉酒成梦
    2021-02-13 10:44

    You can do like this :

    checkboxGroupInput(inputId="test", label="Test", choices=1:4),
    tags$style(type="text/css", HTML("#test>*{float: left; margin-right: 15px; height: 20px;} #test {height: 20px;}"))
    

    Or directly edit a css file, see https://groups.google.com/forum/#!topic/shiny-discuss/EMQV8NbA3MI

    EDIT

    Since shiny 0.10.0, you can use the inline argument for horizontal layout :

    library("shiny")
    ui <- fluidPage(
      checkboxGroupInput(inputId="test", label="Test", choices=1:4, inline = TRUE)
    )
    server <- function(input, output) {
    
    }
    shinyApp(ui = ui, server = server)
    

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