Skip to content

Improve search/multiselect on input_select #1218

Description

@corey-dawson

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

Activity

  1. gadenbuie commented on Mar 14, 2024

    @gadenbuie
    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.

  2. cpsievert commented on Mar 14, 2024

    @cpsievert
    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)

  3. corey-dawson commented on Mar 18, 2024

    @corey-dawson
    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

  4. codenator2 commented on Mar 18, 2024

    @codenator2

    I agree, searchable multiselect input_select would be really nice!

  5. corey-dawson commented on May 22, 2024

    @corey-dawson
    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?

  6. GitHunter0 commented on Jun 19, 2024

    @GitHunter0

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions