I've been trying to make a pickerInput from package ShinyWidgets with subcategories.
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h2("Select / Deselect all"),
pickerInput(
inputId = "p1",
label = "Select all option",
choices = list(subA = c("a","b","c"),
subB = c("a"),
subC = c("a","b")),
multiple = TRUE,
options = list(`actions-box` = TRUE)
),
verbatimTextOutput("r1")
)
server <- function(input, output, session) {
output$r1 <- renderPrint(input$p1)
}
shinyApp(ui = ui, server = server)
The problem is when one subcategory has only one element, the output is a bit weird and does not show as the same as the other subcategories. In my example, I can choose the name of the subcategory (subB) but not the element of this one ("a")
Is there a way to fix this?