Tailwind v4 Support - RFC and Status Update #3192
Replies: 6 comments 9 replies
-
I am down to removing vestigial code as the RFCs suggest. The type scale I didn't even notice at first, while the presets I'd accept removing, though it would be nice if example code would be more prevalent in the tutorials, like as an optional step to the Installation page. |
Beta Was this translation helpful? Give feedback.
-
I've hit a few instances where I felt constrained by the presets and agree that moving this to user-land makes the most sense. Anything which can be made less redundant and fixed in place seems to offer more flexibility in the end. I do agree that examples of add-ons for basic presets for those that don't want or need to roll their own bridges any gap there. |
Beta Was this translation helpful? Give feedback.
-
There's definitely something to be said about having presets that allow you to quickly throw something together without too much manual boilerplate. It's pretty much the whole point of a UI library, in the end. Personally I build a lot of smaller projects using Skeleton, and having to create the presets each time would add a little more "boring" stuff to do before I could actually start creating. Even if it's just copy-pasting it from previous projects. But in the end, it probably doesn't matter too much, I just wanted to mention something that could be an argument against removing them. |
Beta Was this translation helpful? Give feedback.
-
As a light but enthusiastic user I fully support these changes. In my opinion after reading the above I would like to remove the --presets from my existing v3 projects and use the built-in tailwind. So perhaps in the migration guide that could be covered clearly? |
Beta Was this translation helpful? Give feedback.
-
I love using I also like your comment about the Bootstrap-effect. You need to draw a line somewhere between supplying all components and making users come up with their own. I agree drawing the line a bit closer to the user-side, like how Skeleton has been doing. On all the other changes: using Tailwind for all the thing we can is the best approach in my opinion. So, migrating to native solutions is something I won't complain about. |
Beta Was this translation helpful? Give feedback.
-
I really like the variants/presets feature of skeleton and I think it is one of the main reasons for being quick to use and adopt as a non-UI-developer. But hey, I understand if you want to take a step back - just keep a guide for the CSS n00bs like me :) |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, Chris here from the Skeleton team. Today I wanted to share a status update regarding our recent delay to Skeleton v3, as we update to support Tailwind v4. As well as talk about our initial findings for updating an improving existing features. This also comes with two new RFCs shared near the bottom of this post.
Status update on Tailwind v4 Support
Onboarding Improvements
First up, we wanted to let everyone know that we've completed the initial phase on our Tailwind v4 roadmap. This included updating the Skeleton v2 and v3 onboarding, pinning CLI tooling to set versions, which will in return limit installation to Tailwind v3 for now. Generally speaking you should also find the Skeleton v2 onboarding to be much more streamlined.
Tailwind v4 Audit
Additionally, we've completed our initial audit of Tailwind v4. You can find a full run down of our findings in the written post or video below. Note the written post is slightly more up to date though!
Generally speaking we have moved from a theoretical understanding of the changes, to working knowledge after going hands on with our own prototypes. As such we've discovered a number of ways Tailwind v4 can improve Skeleton, which we'll cover below.
Using Sass to Generate Dynamic CSS
Once of the biggest challenges of the new rewrite is moving from the Javascript-based plugin in Tailwind v3 to the CSS-only configuration in Tailwind v4. In previous versions we relied heavily on Javascript to abstract, loop, and generate repetitive properties and classes. This includes a few of the following features:
--color-primary-500
) - combines 7 color names and 11 shades--color-primary-contrast-500
) - same as the base color propertiesIn the previous JS-based plugin, everything was defined using a CSS-in-JS format, which enabled access to JS constants and iterative loops to generate CSS properties and classes. Here's a quick example of that in practice:
While we've truncated for space, generally speaking we loop through each available color name (ex: primary, secondary, ..., surface), generate a color ramp per each shade (ex: 50-950), then feed those values into our plugin, which allows Tailwind to make use of them.
For Tailwind v4, all configuration is now CSS-based, which means we need a replacement for these JS features. We spent the last week testing everything from CSS-in-JS tools (Vanilla Extract, Panda CSS, etc), to generic templating tools (EJS), to contemplating rolling our own home-grown tooling. However, we've settle on a extremely novel solution - we're now building select portions of Skeleton using Sass (aka Syntactically Awesome Style Sheets).
If you've been in the web world for the last ten or so years, you may already be aware of Sass. In many ways it's the predecessor to Tailwind. Before utility class systems were popular, folks leaned on Sass to provide many features not originally provided by native CSS - such as Variables and Nesting. However, we can now lean on this to solve a number of hard problems for authoring our styles in Skeleton:
The result is we can dynamically generate repetitive CSS quickly very quickly and easily - we simply import our source values and iterate with a loop like so:
If you would like to learn more, I'd recommend checking out this post by long time Skeleton contributor @Hugos68. He goes in a bit further into the technical side for why and how this works:
Deprecating Redundant Features
Additionally, we've come to realize that Skeleton currently provides two features that have now been absorbed into the Tailwind core. These include the following:
We never set out to predict the future, but just try to add features that we think can benefit users. That said, our goal is not to replace Tailwind, but augment and extend it. As such, we will be removing the redundant Skeleton features. Moving to adopt Tailwind's
--spacing
property in favor of Skeleton's--space-scale-factor
in our theme settings.Color Scheme for Color Pairings
Speaking of overlapping features, Tailwind v4 now supports new CSS features such as light-dark() and color-scheme. Together these enable a new way to selectively toggle between two specific color values - typically for light/dark interfaces.
If that sounds familiar, it's because it's analogous to Skeleton's own Color Pairing system! However, given this feature is fully native, this comes with a number of benefits. For example, we can now just lean into Skeleton's
@theme
properties and implement pairings as Tailwind colors, like so:We no longer have to emulate these using custom rolled utility classes. It also means this fully supports all Tailwind color properties (ex:
bg-*
,text-*
,fill-*
, etc) out of the box! If Tailwind adds a new color property in the future, it just works, no change required on our end.Additionally, by pairing this with
color-scheme
you will now be able to selectively toggle the light/dark "scheme" at any scope on the page - be that the entire page, a particular section, or even a particular component. See Tailwind's doc for a quick example. Note this is completely isolated and independent of Dark Mode. Though you can certainly pair these together.Furthermore, color pairings are now just treated as if they are first-class Tailwind colors. This means they can take full advanrage of Tailwind's new color transparency mechanics, which use Color Mix. The result is all Skeleton color pairing classes finally support transparency!
RFC: Proposed Preset Changes
Building on the changes to Color Pairing, the team and I have began to rethink Skeleton's Presets system (aka "Variants" in Skeleton v2). These are a group of canned classes that can be used to style common UI elements such as buttons, cards, etc.
While Presets are a hugely popular feature in Skeleton (even among our team), today I want to bring forth a proposal to remove this as a feature provided and maintained by Skeleton. To help explain this, let's look at the source of a few Presets to understand what they represent:
Per the new Color Pairing changes describe above, we can now simplify these down to the following:
This begs the question - if Presets only represent a couple primitive utility classes, then why do they exist at all? Why break away from Tailwind's Utility-First approach to styling? In fact, there's a few caveats that exist because of these abstractions:
We're already encouraging folks generate their own Presets for things like input validation and gradients. So why not make this the default stance for the library? Shorter/reusable/representative classes obviously have a benefit in practice. But maybe those are better maintained in user-land rather than by Skeleton?
The Proposal
Presets become a technique rather than a Skeleton-provided feature. This would include the following changes.
As this is an RFC, please know what you think in the comments below!
RFC: Proposed Typography Improvements
Finally, we have one more change for your consideration - replacing Skeleton's
type-scale
system for Typographic Scale, with a more direct implementation for Tailwind's built-in text classes. Currently this operates by setting the following scale factor - which is then used to calculate the text sizes fortype-scale-[1-13]
For a quick comparison, here's what Skeleton's dynamic
type-scale
classes look like compared to the semantic (but fixed size) classes provided by Tailwind:Our original intention was to keep dynamic scaling typography system separate from Tailwind's built-in text classes. However, after viewing what Tailwind is doing with Spacing (updating the existing mechanic in place) - we think we've taken the wrong approach for Typography. Instead of updating in place, we've duplicated all type sizes, which is very confusing in practice.
Proposal
The proposal here is simple - Skeleton simply removes the
type-scale
utilities and applies the scaling factor to all existing Tailwind utility classes, such astext-base
,text-xl
, etc. And if you prefer not to use this feature, we'll default to Tailwind's existing scale out of the box. No modification required.The benefits here are numerous:
The downside is there may be a small migration for any existing Skeleton v3 user that's already using the
type-scale
primitives. However, we may be able to automate correcting these using Skeleton's new CLI migration tool.Once again, this is an RFC, so we welcome your feedback in the comments below!
Beta Was this translation helpful? Give feedback.
All reactions