1

I am writing a shiny application and in the UI I want the radio buttons and select input options to be in one row.

My ui. R file looks like:

library(shiny)
library(shinydashboard)

dashboardPage(skin = "blue",
          dashboardHeader(title = 'Analysis'),

          dashboardSidebar(
            sidebarMenu(
              menuItem("Summary", tabName = "summary", icon=icon("bar-chart"))
            )
          ),
          dashboardBody( 
            tabItems(
              tabItem(tabName ="summary",
                      fluidRow(
                        radioButtons("radio", "Options", 
                                     list("A","B","C"), inline = TRUE, selected = "A"),
                        selectizeInput("month", "Month", multiple = T, choices = NULL),
                        selectizeInput("year", "Year", multiple = T, choices = NULL)
                              )
                      )
                )
          )
)

How can I make all three in one single line(in one row)?

krish
  • 1,388
  • 2
  • 18
  • 28
  • There's a really nice approach to this here http://stackoverflow.com/questions/20637248/shiny-4-small-textinput-boxes-side-by-side (I've interpreted your question to be that you want all three controls to be on one line) – Benjamin Dec 08 '16 at 21:06
  • @Benjamin, I had seen that post earlier but I missed out the solution using the column option. I was able to get them in one line using the column option without writing HTML/CSS code. Thanks – krish Dec 08 '16 at 21:21

1 Answers1

1

I modified the ui.R file based on the solutions from this post (shiny 4 small textInput boxes side-by-side) and was able to get all three in one line.

library(shiny)
library(shinydashboard)

dashboardPage(skin = "blue",
      dashboardHeader(title = 'Analysis'),

      dashboardSidebar(
        sidebarMenu(
          menuItem("Summary", tabName = "summary", icon=icon("bar-chart"))
        )
      ),
      dashboardBody( 
        tabItems(
          tabItem(tabName ="summary",
                  fluidRow(
                    column(6, radioButtons("radio", "Options", 
                                 list("A","B","C"), inline = TRUE, selected = "A")),
                    column(3, selectizeInput("month", "Month", multiple = T, choices = NULL)),
                    column(3, selectizeInput("year", "Year", multiple = T, choices = NULL))
                          )
                  )
            )
      )
)
Community
  • 1
  • 1
krish
  • 1,388
  • 2
  • 18
  • 28