How to place independent groups of radio buttons on same row and place well panels around the groups in order to delineate them?

Solution 1:

The issue is that

Column widths are based on the Bootstrap 12-wide grid system, so should add up to 12 within a fluidRow() container.

See Application Layout Guide.

As you have given each column the maximum width of 12 they will be placed in separate rows. To solve this issue reduce the column widths to 6.

To get your well panel wrap the radioButton inside a wellPanel:

library(shiny)
library(shinyWidgets)

ui <-
  fluidPage(
    titlePanel("Summary"),
    sidebarLayout(
      sidebarPanel(
        selectInput("selectData", h5(strong("Select data to view:")),
          choices = list("Beta"),
          selected = "Beta"
        ),
      ),
      mainPanel(
        tabsetPanel(
          tabPanel("Private data",
            value = 1,
            conditionalPanel(
              condition = "input.selectData == 'Beta'",
              fluidRow(
                div(style = "margin-top:15px"),
                column(
                  width = 6, offset = 0, style = "padding-right:0px;",
                  wellPanel(
                    radioButtons(
                      inputId = "group1",
                      label = NULL,
                      choiceNames = c("By period", "By MOA"),
                      choiceValues = c("Period", "MOA"),
                      selected = "Period",
                      inline = TRUE
                    )
                  )
                ),
                column(
                  width = 6, offset = 0, style = "padding-right:0px;",
                  wellPanel(
                    radioButtons(
                      inputId = "group2",
                      label = NULL,
                      choiceNames = c("Exclude CT", "Include CT"),
                      choiceValues = c("Exclude", "Include"),
                      selected = "Exclude",
                      inline = TRUE
                    )
                  )
                )
              )
            )
          ),
          id = "tabselected"
        )
      )
    )
  )

server <- function(input, output, session) {}

shinyApp(ui, server)

enter image description here