17

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

Marta
  • 3,493
  • 6
  • 28
  • 43

1 Answers1

23

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)
Victorp
  • 13,636
  • 2
  • 51
  • 55
  • 2
    I have use the `inline` argument for horizontal layout of my checkbox, but how to alin all the box ? – Christophe D. Oct 28 '15 at 11:19
  • @Victorp, I had requirement on use of checkboxGroupInput for usage of filter and displaying items for selected variable in filter. It would help me a lot if you could have a look and suggest. Thank you !! Link to the post is http://stackoverflow.com/questions/41187194/shiny-dynamic-filter-variable-selection-and-display-of-variable-values-for-sel# – user1412 Dec 21 '16 at 13:08