Skip to content

Select all or select all matches in st.multiselect (plus drop down styling)#13015

Closed
sfc-gh-dmatthews wants to merge 59 commits intodevelopfrom
feature-multiselectall
Closed

Select all or select all matches in st.multiselect (plus drop down styling)#13015
sfc-gh-dmatthews wants to merge 59 commits intodevelopfrom
feature-multiselectall

Conversation

@sfc-gh-dmatthews
Copy link
Copy Markdown
Contributor

@sfc-gh-dmatthews sfc-gh-dmatthews commented Nov 14, 2025

Describe your changes

The PR introduces new functionality for st.multiselect to "Select all" or "Select all matches." Because a separator line was introduced between the original options and the new select-all options, a new style was introduced for all dropdowns, so this also unifies styling changes across multiple widgets for consistency.

  • When opening a multiselct drop down, if there is more than one option, a "Select all" option will appear at the top, with a separating line below it.
  • If you search for items in a multiselect by typing and there is more than one match, a "Select x matches" option will appear at the top.
  • When accept_new_options is true for selectbox or multiselect, the "Add" option at the bottom has a separator line above it.
  • The highlight effect for all dropdown was updated so that the highlight is inset. In multiselect, the selected item aligns with the highlighted items in the drop down below and has the same border radius (which is 2px larger than previously). This affects the following:
    • st.multiselect
    • st.selectbox
    • Dataframe column context menu, formatting menu, and visibility menu
    • st.navigation in top mode
    • st.time_input
    • The time subselector of st.datetime_input
  • All dropdown borders and shadow boxes were updated to have shadow box and no border in light mode, and the opposite in dark mode. In addition to the elements listed above, this affects the following:
    • st.popover
    • st.date_input
    • st.time_input
    • st.color_picker

Screenshot or video (only for visual changes)

NewBefore
Add select-all option to multiselect and restyle the highlight (also applies to selectbox)
image image
image image
Adjust roundness and padding of selected items in multiselect (match highlight)
image image
image image
Add select-all-matches option to multiselect and apply new style to add option (also applies to selectbox
image image
Unify style of time input
image image
image image
Unify style of date and datetime input (border & shadows)
image image
image image
Unify style of column menus
image image
Unify style of color picker (border & shadow)
image image
Unify style of top nav
image image
image image

GitHub Issue Link (if applicable)

Testing Plan

  • Explanation of why no additional tests are needed
  • Unit Tests (JS and/or Python)
  • E2E Tests
  • Any manual testing needed?

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 14, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13015/streamlit-1.53.1-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13015.streamlit.app (☁️ Deploy here if not accessible)

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Nov 14, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@jrieke jrieke changed the title [POC] Multiselect all matches [Prototype] Multiselect all matches Nov 14, 2025
@sfc-gh-dmatthews sfc-gh-dmatthews added security-assessment-completed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Nov 14, 2025
@jrieke
Copy link
Copy Markdown
Collaborator

jrieke commented Dec 28, 2025

This generally feels good but few comments:

  • When only one item is left to select, it sometimes still shows "Select all (1)". This shouldn't show in this case since it's only one item you can click on anyway.
    Screenshot 2025-12-28 at 14 03 31@2x

  • The "(N)" behind "Select all" looks a bit cluttered. I would do a) "Select all" without anything else if the user didn't type a search string (then how many items it is doesn't add much value in my eyes anyway) and b) do "Select N matches" if the user typed a search string.

  • The current design with the line doesn't look great. We eventually want it to resemble the image below (see also Add select all shortcut or button for multiselect #4714). There's currently another PR at Enhancement/update dropdown design #12956 #13004 to change the overall dropdown design to make it more similar to below. It would be nice to wait for that to make the line look better (and also add a line for the "Add: ..." option) but I think it's a bit stuck in design, so don't want to block on that. Maybe for now we actually remove the line and then re-introduce it once that other PR is done?
    image

  • I'm wondering whether we should only show this if there are at least M items to show. It looks a bit weird for a multiselect with just two options to always show "Select all" in addition to the two options. WDYT @sfc-gh-dmatthews? Maybe we only show it for more than 3 or 5 options or something like that?

@sfc-gh-dmatthews
Copy link
Copy Markdown
Contributor Author

The design image shows a larger radius on the selected items than the highlights, but I currently have them the same (which was the highlight radius in the design image and the previous radius of the selected items). I wonder about increasing the padding on the sides a bit so the scroll bar won't overlap with the rightmost edge of the highlight. I have the selected items (text and highlight) lining up on the left edge which is a little more horizontal padding on the highlight than the design image.

image

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 26, 2026

📉 Frontend coverage change detected

The frontend unit test (vitest) coverage has decreased by 0.0000%

  • Current PR: 86.4300% (13726 lines, 1862 missed)
  • Latest develop: 86.4300% (13651 lines, 1852 missed)

✅ Coverage change is within normal range.

📊 View detailed coverage comparison

height: "auto !important",
},

// Apply highlight effect and padding to the first div inside the li
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this styling meant to be for the select all?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The highlight effect can apply to any item, including the "select all" and "add" inserted elements. All of the items exist as divs in an li wrapper.

expect(options.length).toBe(2)
expect(options[0]).toHaveTextContent("b")
expect(options[1]).toHaveTextContent("c")
// Should have "Select all" + "b" + "c" = 3 total
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I think these selectors (including the ones above) all need to be updated because options[0] is Select all. Utilize getByText("b") instead, since that's more resilient to these kinds of changes where it reorders items.

// chatInput, full, and maxCheckboxRadius are not impacted by this config.
export const radii = {
md: "0.25rem",
// This is a temporary name prior to refactoring md to sm, which will cause merge conflicts elsewhere.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: When is this refactoring planned to happen?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have to defer to the engineers here. I'd want everyone to have a heads up on the shift of meaning (md -> sm and md -> new). Since it would have to apply everywhere used, it would basically impact everyone, so I just didn't want to touch that in this PR.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little worried about introducing this specific radii, especially given the potential blast radius and given that it's temporary without a specific work item attached to it.

Can we use an existing radii in the meantime?

@mayagbarnes - Tagging you as the theming expert. Any thoughts on what we should do here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There wasn't the correct radii between medium and default, so that why the new one. We previously had medium, default, xlarge, so I could call this one "large", but it is smaller than default, so that didn't seem right.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's literally halfway between, so the other option is to calculate the average on the fly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a slight regression in padding. Notice how the placeholder text in selectbox and multiselect are vertically aligned before. After, the multiselect placeholder text is further to the left:

Before:
Screenshot 2026-01-30 at 2 14 16 PM

After:
Screenshot 2026-01-30 at 2 14 38 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was fighting this one. I'll try again.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I shifted the placeholder by one pixel. Here's the tradeoff that's happening:
To keep the left margin the same as the top and bottom margin of selected items in st.selectbox the padding was reduced by one pixel, I think from border impacts. I had shifted the placeholder text to also align with the text in the dropdown, which had the highlight effect align with the selected background of items in the widget.

So, I've unshifted the placedholder text, but we might need to revisit with Jess and see if we want to shift everything so it all aligns, while maintaining a uniform margin (top, bottom, left) on that first selected item in the multiselect.

Also, looking really close, it looks like there is an inset vs outset border, so the dropdown border itself is a little off.

image image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm still seeing this cause unexpected diffs. See how the placeholder text has changed from old to new:

Kapture.2026-02-02.at.09.27.57.mp4

@sfc-gh-dmatthews sfc-gh-dmatthews added the update-snapshots Trigger snapshot autofix workflow label Jan 30, 2026
@github-actions github-actions bot removed the update-snapshots Trigger snapshot autofix workflow label Jan 30, 2026
@sfc-gh-dmatthews
Copy link
Copy Markdown
Contributor Author

If it's too messy, we can revert the drop down width adjustment and little shifts to deal adding the border in dark mode. It's just a pixel, but you can kind of see that it's off by looking at the first item, scrolled all the way up. cc @sfc-gh-jshamis

@sfc-gh-dmatthews sfc-gh-dmatthews changed the title [Prototype] Multiselect all matches Select all or select all matches in st.multiselect (plus drop down styling) Feb 1, 2026
// chatInput, full, and maxCheckboxRadius are not impacted by this config.
export const radii = {
md: "0.25rem",
// TODO: Rename md -> sm, and md2 -> md
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfc-gh-jshamis said yes to this proposed renaming plan.

@sfc-gh-dmatthews
Copy link
Copy Markdown
Contributor Author

Moved to Graphite stack starting with #13794

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

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants