Add MultiselectColumn for st.dataframe and st.data_editor#9223
Add MultiselectColumn for st.dataframe and st.data_editor#9223lukasmasuch merged 85 commits intodevelopfrom
MultiselectColumn for st.dataframe and st.data_editor#9223Conversation
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
bump |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
bump |
|
Any updates on this? I am happy to fix this if that's the hold up. |
|
@lukasmasuch I am happy to generate tests and work on this, is there a blocker to that? Thanks |
MultiselectColumn for st.dataframe and st.data_editor
There was a problem hiding this comment.
Just some drive-by fixes to use the new width parameter instead of use_container_width in tests.
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new MultiselectColumn column type for st.dataframe and st.data_editor, enabling users to display and edit multiple selections from predefined options with colored labels. This addresses feature requests for multiselect functionality in dataframes similar to existing single selectbox columns.
Key changes:
- Implements complete multiselect column functionality with support for colors, formatting, and option validation
- Adds comprehensive test coverage including unit tests and E2E tests
- Updates existing E2E test files to use new
widthparameter instead of deprecateduse_container_width
Reviewed Changes
Copilot reviewed 19 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib/streamlit/elements/lib/column_types.py |
Implements MultiselectColumn function and supporting TypedDict classes |
lib/streamlit/column_config.py |
Exports the new MultiselectColumn in the public API |
lib/streamlit/elements/lib/column_config_utils.py |
Adds multiselect column data kind mappings |
frontend/lib/src/components/widgets/DataFrame/columns/MultiselectColumn.ts |
Frontend TypeScript implementation of multiselect column functionality |
frontend/lib/src/components/widgets/DataFrame/columns/index.ts |
Registers the new multiselect column type |
lib/tests/streamlit/elements/lib/column_types_test.py |
Unit tests for the Python multiselect column implementation |
frontend/lib/src/components/widgets/DataFrame/columns/MultiselectColumn.test.ts |
Frontend unit tests for multiselect column |
e2e_playwright/st_dataframe_config.py |
Adds multiselect column to E2E test configurations |
| Multiple E2E test files | Updates to use new width parameter instead of use_container_width |
Comments suppressed due to low confidence (1)
frontend/lib/src/components/widgets/DataFrame/columns/MultiselectColumn.ts
Outdated
Show resolved
Hide resolved
MultiselectColumn for st.dataframe and st.data_editorMultiselectColumn for st.dataframe and st.data_editor
frontend/lib/src/components/widgets/DataFrame/columns/MultiselectColumn.test.ts
Show resolved
Hide resolved
| const uniqueOptions = uniqBy( | ||
| preparedOptions.map(opt => opt.value), | ||
| (x: string) => x | ||
| ) |
There was a problem hiding this comment.
suggestion: Utilize a Set here for uniqueness guarantees and performance (will also need to update the .includes to .has below)
const uniqueOptions = new Set(preparedOptions.map(opt => opt.value))
Describe your changes
Adds a new column type -
st.column_config.MultiSelectColumn- that allows a selection of multiple predefined options.Examples:
GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.