Skip to content

feat(adapter): emit sx prop when re-styling sx-aware components#394

Draft
skovhus wants to merge 1 commit intomainfrom
cursor/use-sx-prop-on-wrapped-components-f5e6
Draft

feat(adapter): emit sx prop when re-styling sx-aware components#394
skovhus wants to merge 1 commit intomainfrom
cursor/use-sx-prop-on-wrapped-components-f5e6

Conversation

@skovhus
Copy link
Copy Markdown
Owner

@skovhus skovhus commented Apr 20, 2026

Adds an optional adapter hook wrappedComponentInterface so the codemod can emit sx={styles.x} instead of {...stylex.props(styles.x)} when styled(Component) wraps an already-migrated component that accepts a StyleX sx prop. Requires useSxProp: true.

Open in Web Open in Cursor 

…ing sx-aware components

Adds an optional adapter hook 'wrappedComponentInterface' that lets the
codemod know an imported component already accepts a StyleX 'sx' prop.
When wrapping such a component via styled(Component) and 'useSxProp' is
enabled, the codemod emits 'sx={styles.x}' instead of
'{...stylex.props(styles.x)}' and forwards className/style unchanged so
the wrapped component handles merging itself.

Co-authored-by: Kenneth Skovhus <skovhus@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

🚀 View preview at
https://skovhus.github.io/styled-components-to-stylex-codemod/pr-preview/pr-394/

Built to branch gh-pages at 2026-04-20 17:36 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants