radioGroupButtons not indicating selection in bs4dash

27 views Asked by At

When I try and use radioGroupButtons from shinyWidgets in a shiny dashboard built with bs4dash, the buttons don't show which of the options is selected. Clicking different buttons will clearly change the output but not indicate which was selected.

Example including awesomeRadio buttons which work fine for comparison:

library(shiny)
library(bs4Dash)
library(shinyWidgets)
library(gt)

ui <- dashboardPage(
  header = dashboardHeader(
    title = "test"
  ),
  sidebar = dashboardSidebar(
    sidebarMenu(
      menuItem(
        "radio",
        tabName = "radio"
      )
    )
  ),
  body = dashboardBody(
    tabItems(
      tabItem(
        tabName = "radio",
        fluidRow(
          column(
            width = 3,
            box(width = NULL,
                radioGroupButtons("body",
                                  label = NULL,
                                  choices = unique(gtcars$bdy_style),
                                  direction = "vertical")),
            box(width = NULL,
                awesomeRadio("cntry",
                             label = NULL,
                             choices = unique(gtcars$ctry_origin)))
          ),
          box(
            width = 9,
            gt_output("gt"))
        )
      )
    )
  )
)

server <- function(input, output, session) {
  
  output$gt <- 
    render_gt({
      gtcars |> 
        filter(
          bdy_style == input$body,
          ctry_origin == input$cntry
        ) |> 
        gt()
    })
  
}

shinyApp(ui = ui, server = server)

I know that shinyWidgets is built with Bootstrap 3 and bs4dash is build with Bootstrap 4, so my instinct is to assume that's the issue and I can't fix it. But if there is a way to make radioGroupButtons work, or if there's a similar looking widget from another package (or if I can manually do it myself if it's not all that intense) I'd appreciate knowing.

0

There are 0 answers