I have a checkboxGroupInput
in my shiny app. It seems that the multiple selection is always enabled. What I need is to disable the multiple selection and only allow one selection at a time.
Does anyone know how to do that? Shiny app example below:
ui <- fluidPage(
checkboxGroupInput("icons", "Choose icons:",
choiceNames =
list(icon("calendar"), icon("bed"),
icon("cog"), icon("bug")),
choiceValues =
list("calendar", "bed", "cog", "bug")
),
textOutput("txt")
)
server <- function(input, output, session) {
output$txt <- renderText({
icons <- paste(input$icons, collapse = ", ")
paste("You chose", icons)
})
}
shinyApp(ui, server)
Here is the checkboxGroupInput
function. I'm surprised there is no argument like multiple
. Should I use other widget to serve that purpose? What should I use?
checkboxGroupInput(inputId, label, choices = NULL, selected = NULL,
inline = FALSE, width = NULL, choiceNames = NULL,
choiceValues = NULL)