[feat] Simple sx={} syntax as an alternative to stylex.props#1218
[feat] Simple sx={} syntax as an alternative to stylex.props#1218
sx={} syntax as an alternative to stylex.props#1218Conversation
workflow: benchmarks/perfComparison of performance test results, measured in operations per second. Larger is better.
|
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
|
not sure if we could use this internally with Flow etc, but will try to collect feedback on naming regardless |
|
This would be amazing, if you could get it working on flow especially. We're migrating to stylex at the moment and this is one of my personal pet peeves. We're also on flow (and relay), could you get the flow team to add a custom config like relay has |
|
This would be a big help. Would love to see this so I don't have to alternate between |
|
Will sync with the Flow team on support for this |
|
@mellyeliu did you hear from the flow team. Super interested as we’re starting a large styled components to stylex conversion on a flow code base. This was one of the major sticking points internally and it would be great to know the direction you guys are thinking about. |
<div stylex={[styles.foo, styles.bar]} />It's a naming problem, but in the case of Just wanted to share this perspective. |
|
@matclayton will prioritize this soon! hoping to get some broader Flow integration help from the team |
|
So with TypeScript would consumers have to do something like this or would the StyleX typedefs set it? |
|
may I ask what progress has been made on this? really neat addition! |
|
We are also curious how settled the API is? Would really love to start using this, and are okay with patching if the API is fairly stable. |
I too share this concern. |
|
I haven't forgotten about this. Will share an update by next week, thank you all for the patience! |
|
The Flow team is investigating adding a flowconfig or something similar for this, cc: @panagosg7 |
|
@mellyeliu thanks for giving an update. As this seems to be part the roadmap, would it be possible to release this as an experimental feature without flow support? Or at least confirm if the API is settled? |
What changed / motivation ?
This adds a small syntactic sugar to allow using a
sx=prop on lower-case html JSX elements as an alternative to{...stylex.props}So you can write:
instead of
if you want.
This addresses a very common complaint.
Additional Context
A single test has been added.
This PR is not quite ready to merge yet. The transformation is currently hardcoded.
Pre-flight checklist
Contribution Guidelines