[feat] Move the isolate_styles param in CCv2#13518
Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom Jan 7, 2026
Merged
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the isolate_styles parameter in the Custom Components v2 API, moving it from component mount-time to registration-time. This makes the API more intuitive by configuring style isolation once when defining the component, rather than repeatedly at each mount point.
Key changes:
- Added
isolate_stylesparameter to thecomponent()function for registration-time configuration - Implemented backward compatibility by silently ignoring
isolate_stylesif passed at mount time - Updated documentation examples in type definitions to reflect the new API usage
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lib/streamlit/components/v2/__init__.py |
Added isolate_styles parameter to component() and _create_component_callable() functions; removed it from _mount_component() signature; added backward compatibility logic to ignore legacy mount-time usage |
lib/streamlit/components/v2/types.py |
Removed isolate_styles documentation from BidiComponentCallable protocol; updated Example 2 to show isolate_styles usage at registration time instead of mount time |
lib/tests/streamlit/components/v2/test_component_registry.py |
Added test test_component_mount_ignores_isolate_styles_kwarg() to verify backward compatibility when isolate_styles is passed at mount time |
e2e_playwright/bidi_components/basics.py |
Removed isolate_styles=True from all component mount calls (4 occurrences) as it's now configured at registration time |
c52673d to
1d3b6da
Compare
1d3b6da to
399533d
Compare
Collaborator
|
@cursor review |
lukasmasuch
reviewed
Jan 6, 2026
lukasmasuch
approved these changes
Jan 6, 2026
Collaborator
lukasmasuch
left a comment
There was a problem hiding this comment.
LGTM 👍 but maybe it makes sense to show a deprecation warning via show_deprecation_warning
399533d to
d5cd315
Compare
d5cd315 to
b9e7980
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Describe your changes
Move
isolate_stylesparameter from component mount-time to component registration time. This change makes the API more intuitive by setting style isolation when defining a component rather than when mounting it.Key changes:
isolate_stylesparameter tocomponent()functionisolate_stylesparameter from the component mount functionisolate_stylesif passed at mount timeisolate_styles=Truefrom component calls in e2e testsTesting Plan
test_component_mount_ignores_isolate_styles_kwarg()to verify that passingisolate_stylesat mount time is properly handled for backward compatibilityContribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.