Nick Saunders (@agilecoder) header
Nick Saunders (@agilecoder) profile picture

Creator of @CSSHooks - UI/UX and FP focus

Phoenix, AZ
Joined June 2010
Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)Photo by Nick Saunders (@agilecoder)
What if StyleX used inline styles? I ported StyleX's own site from StyleX to inline styles and benchmarked both. The result? The inline style version was just as fast (or faster) on every PageSpeed metric I checked. I'm not arguing inline styles are faster. Just that performance isn’t the major concern many people claim it is. 🧡
11
7
5
116
25,235
What if Tailwind utilities were just typed variables instead of classes?
25
4
3
150
26,347
You'd get TypeScript-powered autocompletion for utilities.
2
1
1,618
πŸŸͺ CSS Hooks v4 just landed. My favorite addition is flags, i.e. presentational state that can be inherited, transformed, and passed to descendants entirely through CSS - no React Context. But there's more! Get the full update here: nsaunders.dev/posts/css-hook…
1
1
12
537
You chose Effect for type safety. Why are your styles still stringly typed? I ported the Effect UI counter from Tailwind to typed inline styles. Hover included via CSS Hooks.
13
3
92
6,977
One of the pitfalls of atomic CSS is that the last style doesn't always win. The next version of CSS Hooks provides a πš–πšŽπš›πšπšŽπš‚πšπš’πš•πšŽπšœ function that prioritizes styles by their declaration order. Pass the consumer style as the last argument, and an internal component style will never override it unexpectedly. πš–πšŽπš›πšπšŽπš‚πšπš’πš•πšŽπšœ({ πš‹πšŠπšŒπš”πšπš›πš˜πšžπš—πš: "#πŸ·πŸΎπŸ·πŸΎπŸ·πš‹" }, πšœπšπš’πš•πšŽπ™Ώπš›πš˜πš™)
React people, how are y'all handling Tailwind component class conflicts these days? Cant still be using tailwind-merge right? - [:where(&)] hacks are...hacks - layers feel great, but have to use the forbidden @apply what's the one-true way?
9
15
919
Inline styles are a PageSpeed Insights cheat code.
🚨 my site was stuck at 70 in PageSpeed Insights now it's 100 what I changed: β€· all CSS inline, no CSS file β€· no JavaScript before the page shows up β€· React parts load only when you scroll to them β€· fonts served from my own site, not Google Fonts β€· a fallback font sized to match, so nothing jumps when the real font loads β€· cookie banner in the HTML from the start. when JS added it later, it became the LCP on phones β€· sections below the fold skip rendering until you get close (content-visibility: auto) β€· analytics loads only after you scroll or click β€· turned off Cloudflare's auto-added analytics script β€· removed the fade-in on the hero text. Google doesn't count text while it's invisible, so LCP got worse and the weird one: I moved the font preload from head to body. in the head Chrome waits for the font before showing anything took me way too long to find that one πŸ˜…
1
2
135
Congrats on the stable release. I've been waiting for this! Solid.js remains a high-priority framework integration in CSS Hooks v4-next. I'm glad it can be released against a stable version.
It's official. Solid 2.0 is finally here. 5 years ago, Signals went mainstream. Today we do the same with Async Signals. solidjs.com/blog/solid-2-0-t…
1
19
514
Your favorite LLM codes up a complex feature for you. What's your next move: testing or code review?
3
196
Experimenting with flags in CSS Hooks. Flags determine this Panel's background, while cycle() rotates them at each nesting level. Purely CSS-driven. No React Context or props. How would you build this Panel in your styling framework of choice?
1
1
2
265
Experimenting with CSS Hooks flags inside Remix 3's css() mixin. Here, the root follows prefers-color-scheme, and each nested boundary inverts the theme. This is entirely CSS-driven. Curious what this pattern would look like using Remix 3 primitives alone...
1
5
547
I've been working on a Flags API for CSS Hooks v4. Think React Context, but entirely CSS-driven. No need to re-render just because the user selected dark mode.
1
1
175
My use case is automatic theme inversion. No theme prop. No React Context. What's yours?
1
55
With @\scope support in CSS Hooks, you can switch to dark mode in a nested element and then back to light mode again without using React Context. Available in v4 (`next` tag)
146
Stuck on this. It's just an <a>. The button trait safely adds styling and a11y, configured with namespaced props. What's the next trait - longPress?
1
1
1
233
The space toggle is so good. Love at first sight back in 2023. Its superpower is unlocking :hover, @\media, and selectors in the style prop.
We have a new RFC for bringing custom enums to StyleX. It’s syntax sugar around CSS variable toggles aka space hack to let you define a variable somewhere and then use that as a condition within CSS values. Our API works with enums and stylex.match
3
741
A lot of emphasis lately on type-safe styling to guide agents. CSS Hooks v4, available under the `next` tag, adds a new guardrail: It now detects conflicting properties. If you try to mix `background` with `backgroundColor` between style objects, TypeScript catches it.
1
3
476
Inline styles never got CSS capabilities: No :hover. No media queries. No selectors or at-rules. Just static declarations. No-build JSX on unpkg/run means the style prop can finally do what historically it couldn't. Demo toy, or would you actually prototype this way?
Replying to @unpkg
Also new: unpkg.com/run ✨ Write TypeScript + JSX straight in your HTML with no build step, bundler, or import map. Bare imports just work, compiled on the fly by esm.unpkg.com. Great for demos!
1
3
1,539
@\starting-style is a game-changer indeed. I recently added support to CSS Hooks, so you can use it without even leaving the style prop!
CSS finally lets you animate elements when they first appear. πŸ‘‡ `@\starting-style` is Baseline, newly available since August 2024. 🀟 90% Global usage! Before this, transitions didn’t run on an element’s first style update. You needed JavaScript hacks. Now you can define the starting point in pure CSS! Simple, powerful, and long overdue. πŸ’ͺ🏼
2
3
2,399
Nah. Primitives should be flexible, with opinionated things layered on top. Tailwind’s marketing team brilliantly used design tokens to frame a limitation of atomic CSS as a feature. Arbitrary values were of course added later because design tokens can often be too rigid.
StyleX is pretty nice, but it's missing some important things for design systems IMO. One of the best things about Tailwind is that it is a design system. Color tokens, consistent spacing, font sizes, etc. are the default. You can use arbitrary values too but it pushes you away from that. StyleX is just raw CSS by default – no restrictions. You _can_ create variables like in CSS, but it's not the default, and therefore inconsistency is the default. It's a subtle distinction but it really makes a big difference in how a system is used.
1
1
3,942
Is PureScript making a comeback?πŸ‘€
2
8
701
Update: short-lived πŸ˜”
44
Heyyy... CSS Hooks works pretty well in PureScript
1
1
154