I would like to create a checkbox input organized by continents and inside each continent the clickable options would be the countries.
I need to use this checkbox with pickerinput option from shinyWidgets
package.
This is what I tried but its not working
pickerInput(
inputId = "Id008",
label = "With plain HTML",
choices = list(`Africa` = list("NY", "NJ", "CT"),
`Americas` = list("WA", "OR", "CA"),
`Asia` = list("MN2", "W2I", "I2A"),
`Europe` = list("3MN", "3WI", "I3A"),
`Oceania` = list("M4N", "W4I", "I4A")
),
multiple = TRUE,
selected =
)
From the description of what you are trying to achieve I think you are looking for shinyWidgets::virtualSelectInput
which allows to group options:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
virtualSelectInput(
inputId = "Id008",
label = "With plain HTML",
choices = list(
`Africa` = list("NY", "NJ", "CT"),
`Americas` = list("WA", "OR", "CA"),
`Asia` = list("MN2", "W2I", "I2A"),
`Europe` = list("3MN", "3WI", "I3A"),
`Oceania` = list("M4N", "W4I", "I4A")
),
multiple = TRUE,
disableOptionGroupCheckbox = TRUE
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)