Marta
Marta

Reputation: 3843

R Shiny display checkboxGroupInput horizontally

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

Upvotes: 17

Views: 7714

Answers (1)

Victorp
Victorp

Reputation: 13856

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)

Upvotes: 24

Related Questions