-
Notifications
You must be signed in to change notification settings - Fork 645
docs(styled-react): update architecture for polymorphic components #6870
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
docs(styled-react): update architecture for polymorphic components #6870
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the architecture documentation for polymorphic components in the styled-react package to address issues with the as prop, sx prop handling, and component composition. The changes provide a new implementation pattern that correctly transforms sx into className and prevents sx from being passed to wrapped components.
Key changes:
- Replaces forwardRef pattern with styled-components for polymorphic component implementation
- Adds proper
sxprop filtering usingshouldForwardProp - Updates the component creation pattern to use styled-components with
sxmixin
francinelucca
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Updates our architecture docs for polymorphic components based on our mob pair today 👀
This helps to address a couple of problems:
asprop, the base component will not get overridensxbeing applied to nested components, this approach should correctly transformsxintoclassNameand pass it alongsxfrom being passed to the wrapped component