Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arranging inputs with Shiny in R

I have these two checkbox groups, 'one' and 'two'....As you can see, they're stacked on top of each other, and they scroll endlessly down the page.

How can I put these checkbox groups next to each other instead of on top of each other?

   ui.r
 library(shiny)

    shinyUI(pageWithSidebar(

      # Application title
      headerPanel("Example"),


      sidebarPanel(
        checkboxGroupInput("one", "One:",letters[1:26]),
        checkboxGroupInput("two", "Two:",letters[1:26]),

      ),

      mainPanel(

      )
    ))
like image 816
testname123 Avatar asked Jan 23 '26 14:01

testname123


1 Answers

Hello you can do like this, but selectInput with multiple=TRUE is maybe more adapted for what you want.

shinyUI(pageWithSidebar(

  headerPanel("Example"),

  sidebarPanel(
    div(class="row-fluid",
        div(class="span3",
            checkboxGroupInput("one", "One:",letters[1:26])),
        div(class="span3",
            checkboxGroupInput("two", "Two:",letters[1:26]))),

    selectInput("three", label="Three", choices=letters, multiple=TRUE)

  ),
  mainPanel()
))
like image 58
Victorp Avatar answered Jan 25 '26 06:01

Victorp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!