Replies: 7 comments
-
Typically you'd know when you're setting the |
Beta Was this translation helpful? Give feedback.
-
@noghartt I updated your proposal to use the correct syntax for using pseudo-classes in StyleX. This is a known paper-cut and I'm considering possible ways to improve this, but it's currently a lower priority. Alternative:
The benefit of this approach is that it works today and we can simply optimise this use-case in the future. |
Beta Was this translation helpful? Give feedback.
-
UPDATE: I take it back, I think the reason for things not working isn't stylex issue but from the Vite-plugin I'm using. The issue I had was specificity issue and I resolved it by this:
|
Beta Was this translation helpful? Give feedback.
-
@tounsoo complex selectors are not supported in StyleX and will error in the near future. |
Beta Was this translation helpful? Give feedback.
-
@nmn is there a recommendation on how to handle complex selectors like the one I have above? |
Beta Was this translation helpful? Give feedback.
-
@tounsoo In almost all cases, your React (or other UI framework) component are responsible for setting the attributes such as As for the backgroundColor: {
default: `light-dark(${tokens.colorGray100}, ${tokens.colorGray700})`,
"@media (hover: hover)": {
default: null,
":hover": `light-dark(${tokens.colorGray200}, ${tokens.colorGray600})`,
":active": `light-dark(${tokens.colorGray300}, ${tokens.colorGray500})`,
},
":active": `light-dark(${tokens.colorGray300}, ${tokens.colorGray500})`,
}, We're currently working further improvements to such scenarios. |
Beta Was this translation helpful? Give feedback.
-
We do not plan to add any new syntax for defining values for multiple pseudo classes at once. We might add more syntax in the future, but we don't want to add any new syntax purely for convenience while we polish all the functional rough edges of StyleX. |
Beta Was this translation helpful? Give feedback.
-
Describe the feature request
I have a specific approach where all my buttons should follow the same aspect while with
disabled
attribute. In that case, we should need to disable any style interaction when hovering. I think that would be a great DX improvement if we could handle more elements being applied into the same rules, or just to pseudo-class.The current approach
This approach is what is working now:
Proposal
What I proposing is handle all these pseudo-class into just one object, for example:
Beta Was this translation helpful? Give feedback.
All reactions