dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
834 stars 153 forks source link

Choices max size? #699

Closed Unperterbed closed 2 months ago

Unperterbed commented 5 months ago

Not really an issue, but I couldn't find info on the max number of choices that can go in choices, choicenames, or choicevalues for the different inputs. For context, I have an app deployed with a pickerinput whose choices will grow by about 2000-3000 each year. The choice list is populated by a SQL query, and the database is storing info about various company jobs. The pickerinput with search and subtext is by far the easiest way to search and select a job from the database, so I'm wondering how long I have until I have before I run out of capacity. Thanks!!

pvictor commented 3 months ago

Hello,

pickerInput() might be slow with large volume of data, if it's the case you can switch to virtualSelectInput() that can support 110k choices easily, e.g. :

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  virtualSelectInput(
    inputId = "ID",
    label = "Single select (with 97310 choices) :",
    choices = sort(unique(babynames::babynames$name)),
    search = TRUE
  ),
  verbatimTextOutput("res")
)

server <- function(input, output, session) {
  output$res <- renderPrint(input$ID)
}

shinyApp(ui, server)

Victor