-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[system] Add shouldForwardProp
to theme component configuration
#47103
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
Open
Copilot
wants to merge
6
commits into
master
Choose a base branch
from
copilot/add-shouldforwardprop-to-theme
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+284
−0
Conversation
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
…ess) Co-authored-by: michelengelen <[email protected]>
…eeded Co-authored-by: michelengelen <[email protected]>
Co-authored-by: michelengelen <[email protected]>
Netlify deploy previewhttps://deploy-preview-47103--material-ui.netlify.app/ Bundle size report
|
shouldForwardProp
to theme component configuration
Copilot finished work on behalf of
michelengelen
October 20, 2025 12:17
@copilot please remove the IMPLEMENTATION_NOTES.md file from the PR |
Co-authored-by: michelengelen <[email protected]>
Copilot finished work on behalf of
michelengelen
October 21, 2025 08:44
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
scope: system
The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI
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.
Add
shouldForwardProp
to themeThis PR adds support for
shouldForwardProp
in theme component configuration to prevent custom variant props from being forwarded to the DOM.Implementation Complete ✅
shouldForwardProp
option to theme component configuration typescreateStyled.js
to respect theme-levelshouldForwardProp
ThemeProvider
to register theme shouldForwardProp configurationsStill TODO 🔧
What This Adds
Users can now specify
shouldForwardProp
in theme configuration to prevent custom props from reaching the DOM:Architecture
Global Registry Pattern: A registry maps component names to their theme
shouldForwardProp
functions. The styled component'sshouldForwardProp
is wrapped to check both component-level and theme-level configurations.Registration: ThemeProvider registers configurations in
useMemo
before children render.Prop Filtering: The wrapped
shouldForwardProp
checks the registry at runtime for each prop.Files Changed
packages/mui-material/src/styles/components.ts
- Added shouldForwardProp field to all componentspackages/mui-system/src/createStyled/createStyled.js
- Registry and wrapper logicpackages/mui-system/src/ThemeProvider/ThemeProvider.js
- Registration logicpackages/mui-system/src/styled/styled.test.js
- Comprehensive testsKnown Issues
Tests show props are still being forwarded despite the implementation. Further debugging needed to identify if this is a timing issue, Emotion caching, or logic error.
Original prompt
Fixes #34831
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.