Search code examples
rshinydata-scienceshinywidgets

checkboxGroupButton - Select one at a time


I'm trying to create a radiobutton in the style of the checkboxGroupButton() in R shiny.

I want to recreate this example with the same button aesthetics, but only allow the user to select one input at a time.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  tags$h1("checkboxGroupButtons examples"),
  
  checkboxGroupButtons(
    inputId = "somevalue1",
    label = "Make a choice: ",
    choices = c("A", "B", "C")
  ),
  verbatimTextOutput("value1")
)
  
 

server <- function(input, output) {
  
  output$value1 <- renderPrint({ input$somevalue1 })

  
}

if (interactive())
  shinyApp(ui, server)

Thanks!


Solution

  • Figured it out - can simply be solved by replacing the checkboxGroupButtons() function with radioGroupButtons()