The styling system for the modern web * 🌐₊˚

🎉 It’s release day! v0.6.1 is out. This is release is all about types…for CSS variables.
3
11
79
23,806
CSS variables can now have types that are enforced by the browser. StyleX now exports functions such as stylex.types.color() that can be used when defining variables.
2
1
13
1,082
This may not be a good idea. Help us decide.
We have an RFC for an API to define styles completely inline. Would love your feedback! github.com/facebook/stylex/i…
4
1,290
StyleX retweeted
The web has more constraints. We want SSR. Layout without JS. Etc. This means the need to use things like Media Queries, pseudo classes and specific HTML elements. React Native for Web made doing some of this hard. Going the other way causes fewer constraints. If anything, bringing more declarative APIs like media queries to RN seems to *help* code quality. This is why we’re working on @stylexjs and React Strict DOM.
What is React Strict Dom and how might it change things? Check out latest episode with @dan_abramov2 for more
1
16
3,415
StyleX retweeted
What I’ve tried so far
Is there a way modern bundlers can understand and bundler imports of CSS data URLs? If so, please let me know. github.com/facebook/stylex/p…
2
8
1,792
If you were confused by all these terms, here’s simplified descriptions.
CSS Cascade: The strategy used for choosing which CSS rule should win multiple rules apply. Aka Specificity Wars. Inheritance: Child elements getting some styles from their parents. E.g. font-size, color, etc. Composition: Merging styles to customise base component styles.
1
4
1,098
CSS Cascade: The strategy used for choosing which CSS rule should win multiple rules apply. Aka Specificity Wars. Inheritance: Child elements getting some styles from their parents. E.g. font-size, color, etc. Composition: Merging styles to customise base component styles.
9
1,655
CSS is powerful and has amazing features. CSS layers is one of those amazing features. Our job is to generate CSS that makes good use of that power while giving developers an interface that is vastly simpler, easier and more predictable.
Replying to @stylexjs
@stylexjs is so clever. It uses Cascade Layers to make CSS predictable, so last **always** wins. Bascially all CSS libraries struggle with this unless you manage cascade layers yourself, but StyleX generates cascade layers for you as a side effect
1
8
1,628
StyleX retweeted
The only concepts you need to understand in StyleX: 1. Style Objects - apply them, merge them, use them conditionally whatever 2. Variable Objects - use them within styles 3. Themes - set values for variables on a UI sub-tree That’s it. Seriously.
2
5
48
3,810
Just CSS* *without selectors.
3
2
26
2,012
Seriously. Try @stylexjs. It's immaculate
1
7
1,620
With StyleX recently going open source, Naman Goel (@naman34), @stylexjs lead, talks about the styling system, how it was created, and what it’s offering React developers now. Apple: buff.ly/49pvLtK Spotify: buff.ly/3OR7eWi Google: buff.ly/3OQOTZz
3
12
7,885
Replying to @rauchg
Excited to see this play out: nativewind is a fantastic DSL for web+native, but with Meta investment in @stylexjs as the unifying styling layer between web+native, stylex or tailwind->stylex becomes really compelling.
1
1
3
566
.@stylexjs takes some getting used to but it's easily the safest CSS authoring experience I've had, inclusive of CSS variables
1
3
3,231
StyleX retweeted
Tailwind moved this forward. @stylexjs is the next step in that journey.
Tailwind isn't great but life before Tailwind were dark times
1
10
1,485
StyleX retweeted
Trying to document the advanced utility types VarGroup and Theme in @stylexjs Would love some feedback if the short write-up makes sense. stylex-pdls2p2dl-fbopensourc…
2
1
1
743