👀 sneak peek of @stitchesjs beta
The generated class will contain a hint of whether the style as added via a variant or an override
This also allows you to toggle entire variants/overrides on and off when debugging. Love it!
A nice debugging experience improvement 🥳
I love the `styled` API of @stitchesjs - it returns a typed polymorphic React Component, with your variants as props
But the more I use the core API the more I love it ❤️
```
const button = css({ color: '$red600' })
<button className={button} />
```
✨framework agnostic✨
The Tabs Primitive is a good example of encapsulating styles
1. import from @radix_ui
2. add styles (in this case with @stitchesjs)
3. export
fully accessible component ready to go ⚡️
Some reasons why you may want to "wrap" a @radix_ui Primitive and re-export it as your own
- choose your own API
- omit certain parts
- encapsulate behavior
- limit use cases
- encapsulate styles
- build design systems
a couple of examples 👇️
Another cool thing is that it’ll work seamless with @stitchesjs and other libraries that follow the System UI Theme Spec
import colors from 'radix-ui/colors'
import { createStyled } from '@stitches/react'
const { styled } = createStyled({
tokens: {
colors
}
})
👋 Over the next few weeks, I'll mainly be tweeting about
- @stitchesjs: coming out of beta
- @radix_ui: lots of new primitives, ready-to-use design systems, colors and more
- @modulz: true collaboration between design-dev
Hit me up for demos, live streams, podcasts, etc 🍿
Which naming do you prefer for color variables?
A)
blue-bg1
blue-bg2
blue-bg3
blue-bg4
blue-line
blue-border
blue-borderHover
blue-pure
blue-text
B)
blue100
blue200
blue300
blue400
blue500
blue600
blue700
blue800
blue900
.@stitchesjs by the folks at @Modulz is by far the most impressive implementation of a utility-first approach to styling. With a good configuration, I’d wager you’d have all the productivity of tailwind, minus the API shortcomings. In a TS project it’s even better 🔥
The app is styled with @stitchesjs and the view's code scope includes a set of pre-styled components that consume tokens from the app's current theme. They're also wrapped with Framer Motion props, so animation is a breeze too (see the gif in the first post).