Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Shiny display checkboxGroupInput horizontally

Tags:

checkbox

r

shiny

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

like image 892
Marta Avatar asked Feb 24 '14 10:02

Marta


1 Answers

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)
like image 98
Victorp Avatar answered Sep 25 '22 03:09

Victorp