dreamRs / shinyWidgets

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

Choices max size? #699

Closed Unperterbed closed 1 week ago

Unperterbed commented 2 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 2 weeks 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