Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search/multiselect on input_select #1218

Open
corey-dawson opened this issue Mar 13, 2024 · 6 comments
Open

Improve search/multiselect on input_select #1218

corey-dawson opened this issue Mar 13, 2024 · 6 comments

Comments

@corey-dawson
Copy link

The python version of selectInput has some nice features, such as nesting dictionaries as selectable values, however, lacks functionality in multiselect and searching to satisfy a wide range of application needs. My recommendation is to take inspiration from the R shinywidgets pickerInput which implements a much enhanced input with options for everything mentioned below

R picker input reference

R Shiny PickerInput

Recommended Enhancements

Multi-select improvements

  1. should have an option to add select all / deselect all button
  2. should have an option to change multiselect highlighting to adding a check next to the selected
  3. Should have an option to display the number of rows selected after n selections

Search

  1. should have a search bar option

R Example Code with Better Select Input

library(shiny)
library(shinyWidgets)
library(base)

states <- state.abb

ui <- fluidPage(
  pickerInput(
    inputId = "input_state",
    label = "Select State[s]",
    choices = states,
    multiple = TRUE,
    options = list(
      `actions-box` = TRUE, # add select / deselect all
      `live-search` = TRUE, # add search bar
      `selected-text-format` = "count > 2" # show count once 3 items selected
    )
  ),
  verbatimTextOutput("value")
)

server <- function(input, output) {
  output$value <- renderPrint(input$somevalue)
}

shinyApp(ui, server)

image

@gadenbuie
Copy link
Collaborator

Thanks for the comment @corey-dawson! The shinyWidgets pickerInput() certainly looks useful and we'd be happy to see a Python implementation. That said, we strive for feature parity in core Shiny components between R and Python, so it's very unlikely that we would let the two implementations diverge.

@cpsievert
Copy link
Collaborator

I also think, if we were to pursue a Shiny component for this, we would build off of ideas from rstudio/bslib#484 (searchable list of checkboxes instead of a select dropdown UX)

@corey-dawson
Copy link
Author

I also think, if we were to pursue a Shiny component for this, we would build off of ideas from rstudio/bslib#484 (searchable list of checkboxes instead of a select dropdown UX)

I am not against that. Excel/Powerbi has searchable checkboxes and it might be the most popular search prompt ever

@codenator2
Copy link

I agree, searchable multiselect input_select would be really nice!

@corey-dawson
Copy link
Author

I also think, if we were to pursue a Shiny component for this, we would build off of ideas from rstudio/bslib#484 (searchable list of checkboxes instead of a select dropdown UX)

@cpsievert , is this functionality in the works?

@GitHunter0
Copy link

A really essential feature in my opinion is the implementation of virtual scrolling to avoid letting the app very slow when there are many input options (which happens frequently and is painful).

Based on this project, shinyWidgets provides the function virtualSelectInput() which works very well.

It would be great to have it on Python as well, specially since neither Streamlit nor Dash have this feature, so it would be an extra appeal to attract new users towards Shiny.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants