Skip to content(if available)orjump to list(if available)

Vanilla JavaScript support for Tailwind Plus

ricardobeat

    <el-dialog-panel class="mx-auto block max-w-3xl transform overflow-hidden rounded-xl bg-white shadow-2xl ring-1 ring-black/5 transition-all group-data-closed/dialog:scale-95 group-data-closed/dialog:opacity-0 group-data-enter/dialog:duration-300 group-data-enter/dialog:ease-out group-data-leave/dialog:duration-200 group-data-leave/dialog:ease-in">
Lovely. Verbosity aside, now on top of knowing CSS you need to learn another hierarchical system within class names.

gloosx

Oh yeah, when I open a typical big project with Tailwind I always love to see some:

  <div class="group relative w-full max-w-md mx-auto bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-lg p-6 md:p-8 transition-all duration-300 hover:shadow-xl hover:border-blue-500 dark:hover:border-blue-400">
  <div class="flex items-center justify-between mb-4">
    <h3 class="text-lg sm:text-xl font-semibold text-gray-800 dark:text-white tracking-tight group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">Team Settings</h3>
  </div>
  <p class="text-sm sm:text-base text-gray-600 dark:text-gray-400 leading-relaxed mb-6">Manage your team permissions, invites, roles, and integrations here. Changes apply instantly across all team workspaces.</p>
  <div class="flex flex-col sm:flex-row gap-4 sm:justify-end">
    <button class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors">Cancel</button>
    <button class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-300 transition-all duration-150">Save Changes</button>
    </div>
  </div>

timeon

Every purple-gradient or blue-gradient website.

AstroBen

I just can't fathom how someone can look at this and think "yeahhhh thats some good clean code". How did tailwind get so popular? Learn plain CSS. It's really good now

Jaygles

I've worked in many different FE codebases with a variety of CSS "strategies".

This sort of thing is objectively ugly and takes a minute to learn. The advantages of this approach I found is two-fold

1. You can be more confident that the changes you are making apply to only the elements you are interested in changing

You are modifying an element directly. Contrast with modifying some class that could be on any number of elements

2. You can change things around quite quickly

Once you're well familiar with your toolset, you know what to reach for to quickly reach a desired end state

AstroBen

This is one of the least elegant ways to scope CSS though.. you may as well just write inline CSS

I like BEM personally. "navbar__item" scopes the styling to the nav item

> Once you're well familiar with your toolset, you know what to reach for to quickly reach a desired end state

This also applies to plain CSS, doesn't it?

The big value add that Tailwind brought isn't their utility classes IMO - it's their philosophy around having a design system of consistent coloring and spacing. I actually borrowed that for my own projects. It taught me to be a lot more diligent about specifying the system upfront. Put it in CSS variables and re-use those

Levitating

Why not just use the style attribute?

eviks

1. Aren't there good tools that can list all the elements a style would be applied to so that you can pick and change only the ones affecting the element you need?

iambateman

Agree, and to add…the “component” still needs to exist somewhere in the system for tailwind to make sense.

No one is writing a long paragraph of styles for _every_ button in their app.

input_sh

Can I copy some random HTML+CSS snippet from the internet and be sure that it'll look exactly the same in my project and that no existing CSS is going to overwrite it?

I'm never gonna argue learning proper CSS wouldn't be better, but Tailwind is by far the path of least resistance for someone that has no interest in writing frontend for a living. It's like putting legos together, it requires very little thought to get from nothing to a decently looking website.

omnimus

Tailwind goes into crazy extreme so people can copy paste whole complex components and they work. That’s why you can dunk on these verbose examples.

This is not how custom functional css codebase looks. In custom projects you change the system/configuration to fit the project. You create your own utilities for example you wont have “text-lg sm:text-xl font-semibold tracking-tight” but will have class “font-heading-2”. Similarly you will create button/input classes that have you basic styles.

Generally you start with just simple utility classes inside html and go from there and where it make sense or its too complex you separate to more complex class. You end up with short css file that only has these special components and none of the basic stuff.

For most elemets it ends up like “flex justify-center gap-4”. In BEM i have to invent “nav-secondary__header” put it in correct place and hate myself when i need to change it to “flex justify-beween”.

Tailwind popularised functional css but is also aimed at masses/noobs. Somehow some of those concepts also resonated with some experienced users.

har777

I like how tailwind provides scoping automatically. But in projects already having a build system I use css modules. Writing pure CSS is so much nicer but please don't make me manage class names myself.

pjmlp

Fashion driven development, and magpie developer references come to mind.

troupo

This is objectively good clean code when you develop it.

Because most of those classes are per component.

If you have a single card component defined with these classes, and then repeat it 20 times on the page, then of course the output will look like a giant mess.

> How did tailwind get so popular?

- quick to understand and get started with

- much cleaner for components than the variety of CSS-in-JS libs

- (mostly) do not require fighting CSS with BEM-style atrocities

- come with nice default styles and colors that can be easily changed and extended

> Learn plain CSS. It's really good now

CSS is okay now. We only just got nesting and scoping

pjmlp

No idea, thankfully I am doing mostly backend and devops stuff, so I don't need to care.

If I do something myself, I keep using bootstrap, as it is good compromise for those of us not honoured with CSS mastery.

Ironically I have no issues making great looking UIs with native toolkit.

In 5 years the tailwind craziness will be replaced by the next shiny CSS of the month.

emmanueloga_

In real projects I typically group the classes in a way that makes it easier to read, something like this:

    <div class={tw(
      "block",
      "transform transition-all",
      "bg-white ring-1 ring-black/5 rounded-xl shadow-2xl",

      "max-w-3xl mx-auto overflow-hidden",

      "group-data-closed/dialog:opacity-0",
      "group-data-closed/dialog:scale-95",

      "group-data-enter/dialog:duration-300",
      "group-data-enter/dialog:ease-out",

      "group-data-leave/dialog:duration-200",
      "group-data-leave/dialog:ease-in"
    )}>
        ...
    </div>
I currently do this manually but it would be nice to have some tooling to automate that kind of format.

Brajeshwar

I do this to this day, when I’m writing manual vanilla CSS. I group spacings, fonts, texts, borders etc together so it is easier for me to debug without using too many tools.

Brajeshwar

I have a feeling that Tailwind started with a good intention to be a utility classes CSS framework, akin to “Bourbon on Steroids”, but people began to accept and use their prototype/sample/example codes way better than they had intended, and they ran with it.

I stumbled on Tailwind in 2018 and introduced it to a team looking to revamp a pretty massive project. I remember that the initial proposal I made was to treat it like Bourbon[1] and write classes that build on Tailwind’s utilities. That way, you can still have `.button`, `.button-primary`, and `.button-primary__accent` etc without the cryptic classes in the HTML.

However, after reading Tailwind, the team found it much easier to write the pre-built classes and stack them as they progressed. And it worked; if I don’t care about how the code is written, things were consistent. It reminds me of “Pixel Perfection” before the responsive design era, when things looked as designed in Photoshop and printed for clients during presentations.

1. https://www.bourbon.io

omnimus

Dont’t forget Tailwind is popular because people can copy paste chunks of HTML. Selling premade HTML is how Tailwind is funded.

It is also pretty good configurable utility framework but that is secondary and new version 4 is worse at customisation.

So people are moving to https://unocss.dev/ with tailwind naming conventions.

k4runa

Tachyons CSS was also around at the same time but Tailwind had simpler naming conventions so instead of `br4` you had `rounded-lg`.

1. https://tachyons.io/

philipp-spiess

We actually ended up adding the custom animation-specific data props to all dialog specific custom elements before the release, so the group-*/dialog is no longer necessary but I forgot to update the code in the post.

I doubt that changes your mind, though.

oleggromov

I came to comment that at least something good happened to the otherwise cursed project... but you made me reconsider.

timeon

Not to mention that for every class here there is also definition in CSS that client needs to download.

davidw

It's like Forth and CSS had some kind of hideous offspring.

judah

Looks like it's done using standards-based web components[0]. The page says these components don't require any existing JavaScript framework; because web component support is built-in to the browser.

Nice to see devs picking up web components.

[0]: https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...

cchance

This has been soooooooo long in the making, i remember playing with webcomponents for personal stuff years ago when i didn't care about compat. Good to see mainstream libraries finally picking it up

oaxacaoaxaca

https://webawesome.com is now in beta and I couldn't be happier.

reactordev

12 years I’ve been saying this… 12, damn, years. React graduates look at me crazy. Angular devs say it’s not needed anyway. Svelte bros say get bent. I’m so happy that someone is paying attention.

You don’t need a shadow dom, you don’t need rerendering of everything when a simple value changes. You simply need web components and scoped js/ts with vite or whatever rollup you use.

JoeyJoJoJr

Can you point to any example projects or a todo list app that shows how modern web component can be utilized.

hyperbolablabla

I remember toying with Polymer circa 2014, for some reason the word "transclusion" jumps into my mind, I remember being excited about it at the time. I barely remember what it means today though.

8n4vidtmkvmk

Polymer still haunts me to this day. It never made sense. It was literally designed to be deprecated. It's a big nasty polyfill for web components and it had/has a huge perf overhead. Not to mention it's ergonomics are just bad.

julik

I believe "transclusion" was the Angular 1.x vernacular for "slots", but don't quote me on that ;-)

shortrounddev2

We use web components at the hook for my company's advertising code but I've found them pretty thoroughly disappointing, personally. They make it simple to trigger code execution but their API isn't really that good

spankalee

The whole point is to make it simple to trigger code and to be interoperable. Then you write whatever code you want to implement the component.

Web components are not analogous to frameworks because frameworks tightly couple the component interface and lifecycle hooks with the component implementations. Those are properly decoupled in web components and you bring whatever rendering layer you prefer.

combyn8tor

This is great. Last time I looked into this UI component world I was surprised the popular UI libraries weren't all 'headless' at their base. Web components have been around a long time now. What was stopping this approach?

There are so many framework specific libraries like shadcn, and the community set about building half finished conversions for different frameworks like Vue, which are always several iterations behind and don't really work properly. They have their own version of the docs and it all relies on a specific version of Vue and a specific version of Tailwind and whatever else. It's an abomination.

Start with headless UI as a base and then build wrappers for specific frameworks if you really feel the need. But the wrappers should be syntax sugar only and linked directly to the base library.

I'm sure it's all more complicated than that but a man can dream.

chrismorgan

Put simply: if you’re using something like React, Vue, Svelte, whatever, then Web Components are strict overhead in terms of bundle size and runtime overhead. And when there’s impedance mismatch between the two worlds, which I hear is particularly common in React (can’t attest it personally, I don’t use React), you have to compromise on functionality or ergonomics, or else do fancier bindings, at which point why even bother with Web Components?

It will also commonly not play nicely with some more advanced aspects of the frameworks, like server-side rendering will probably suffer (depending on how exactly things are done).

In a world where React is dominant and you’re wanting to use React yourself, targeting Web Components just doesn’t make sense.

Then “headless” makes it worse. The more comprehensive implementations have a lot of overhead.

combyn8tor

Here's my put simply:

We've got some UI components built with html, CSS and JavaScript. They use web standards.

We want to add them into web frameworks that are built in JavaScript. They are built for html, CSS and JavaScript.

No need to overcomplicate things.

And for a universal component library I'll happily accept 7kb extra overhead in my 4mb React slop website

abtinf

The world would be a significantly better place if someone could throw a small mountain of money at the Tailwind folks so that they can stop worrying about money and simply make the full tailwind experience freely available. There are so many lost opportunities for deep integration with other projects.

Kind of like how Jeff Bezos threw a bunch of money at 37signals at some insane valuation, which helped them completely avoid the VC trap.

abxyz

Worried about money? They are already rich beyond their wildest dreams. They are, reasonably, excited about growing and expanding and building a company that does much more, but that is not driven by a need for money, it is driven by their ambition.

edit: I can’t speak for Adam etc., this is just my impression. My impression is that they want to build a business of which tailwind (the open source project) is one part. I think that regardless of money in the bank they would want to have revenue generating projects. Laravel is a good comparable.

_betty_

interesting, i had just watched Primeagens Standup with Adam and got the impression they don't do well for money, but a quick google came up with a bunch of posts from Adam himself disclosing some fairly impressive numbers.

No idea if he still does ok from it, but he certainly did at one stage.

adamwathan

We are still healthy and profitable but revenue is down about 60% from peak, and continuing to trend down (I think mostly due to AI and open-source alternatives to the things we've historically charged for.)

So things are fine but we do need to reverse the trend which is why we are pretty focused on the commercial side of things right now.

We started a corporate sponsors/partner program recently, and I'm hoping that will earn us enough funding to focus more on the free/open-source stuff, since that's where we create the most value for the world anyways. Fingers crossed!

subarctic

Fwiw I feel like their components are something I'd be less likely to want to pay for now that you can generate tailwind components so easily with ai. I guess now that I think of it I actually paid for them back when it was called Tailwind UI, but instead of using them I'm just telling claude to generate a UI for me, which has the advantage that there's no licensing issues. It'll be interesting to see how their business does going forward

nikkwong

How has shipping high quality products using AI generated tailwind components actually been working for you? I think the problem that I and many others have/had, is that it can certainly build a few components that look good in isolation, but it doesn’t do a good job at maintaining a cohesive theme/idea across many different page sections/components etc. I built blendful [0] to solve this, and sort of lost interest when LLMs became increasingly capable. However, seeing them not making any gains, really, on visual cohesion between sections and components provoked enough excitement to continue working on it this year.

We will see how long it takes for LLMs to make headway in this area specifically.

[0]: https://www.blendful.com

subarctic

I'm not there yet, but I wouldn't say I've ever shipped anything with a high quality cohesive frontend. In general though, don't people usually ditch these component libraries and write their own set of components once they reach a certain point?

agloe_dreams

> Kind of like how Jeff Bezos threw a bunch of money at 37signals

Honestly, I kinda feel like 37Signals would have been better off with the founders having someone to report to...

moooo99

How so? As an outsider, they appear to be a healthy business ans a good employer to work for?

richardlblair

Didn't see today's DHH rant about talk therapy?

jw1224

The “full Tailwind experience” is already freely available. What “lost opportunities for deep integration” is a frontend CSS framework missing?

Tailwind Plus (the commercial product) is like buying an off-the-shelf template. It’s just a collection of themes and pre-built components — useful for devs who want to get started quickly on a project, but it’s cookie-cutter and can easily be replicated by anyone with Tailwind itself.

vinnymac

There are devs who think the currently available HTML elements are all we needed. But there are many more that believe we are missing primitives that Tailwind (and others) is attempting to solve for.

> It’s just a collection of themes and pre-built components

All reusable web components could be described as an optionally themed pre-built component. That's kind of the point.

kyriakos

I no longer see value in prebuilt templates since LLMs can put things together sufficiently well for prototyping. Even when using templates before you still needed to customise them. Feels like we are going through a transition period.

brailsafe

> There are so many lost opportunities for deep integration with other projects.

What kind of integrations are you thinking of?

bluetidepro

I think you are confused? Tailwind is already free and open source? These are just components they sale that are pre-made to save you time. It doesn’t take away much at all from the full experience?

devmor

From the linked article:

> To pull this off, we built @tailwindplus/elements — a library we're releasing exclusively for Tailwind Plus customers.

This means if you want to use the Tailwind UI components without a Javascript framework, you have to build them all yourself, or pay.

ayhanfuat

I wouldn’t get too excited about it to be honest. At one time they were also supporting Vue but it is now basically abandoned.

spankalee

This is Vue support.

With so many frameworks out there it's infeasible to build custom wrappers for them all. With web components they can build once, and work everywhere. It's only up to the frameworks to make sure they have great web components support (which just means great HTML support).

skrebbel

Vue has great web component support. Even React 19 (finally!) does.

Web components are a mess but this is a great application of them: shipping reusable components that work in all frameworks. It's the one and only killer application of web components.

Frankly I'm surprised they're marketing this as "for vanilla javascript" and not as a "now supports all frameworks" type positioning.

ayhanfuat

That’s not really the point. Tailwind UI depends on Headless UI. Headless UI had both Vue and React packages. The Vue package was abandoned. Many are in the process of finding workarounds for the issues or moving to another library. This new shiny thing can be used in Vue, sure. I know better now to not build anything on top of it though.

dawnerd

They also had a figma design library that went away. Kinda silly if you want to get designers on the same page.

GenerWork

At this point, the new crop of AI enhanced design tools are basically skipping vector based design and jumping right to code. A lot of them are using ShadCN/UI which is styled using Tailwind, so it's more like designers are somewhat unknowingly getting onto the same page as Tailwind.

croes

It’s tailwindcss for a reason

Imustaskforhelp

This is the only feature I genuinely want available for tailwind free users too. Sounds really interesting and I can't even try this? That's a shame.

But I understand that funding open source is never easy & I still appreciate tailwind from the bottom of my heart simply because some might hate it for what it is, but I appreciate that I have options to being with (daisy,tailwind etc.)

If anyone who has ever contributed to open source is reading this. Thanks. I am a real frugal person but one day, I want to earn enough money that I can donate to you guys without hesitation and be an open source contributor too.

bikeshaving

This is a exciting use-case for custom elements, and probably how tailwind should have been implemented from the start, but it’s hilariously a paid feature?! (https://tailwindcss.com/plus#pricing) Intuitively, I’d expect the custom elements to be free and the framework integrations to cost money.

gavinray

Tailwind Plus is a paid collection of UI components and templates.

TailwindCSS itself is meant to be nothing more than a styling tool, like Bootstrap...

conradfr

Bootstrap has javascript components.

dzonga

different business models. bootstrap was made by twitter which was making money in it's way. while tailwind their monetary model is selling components.

for me the only thing I wish bootstrap had was the money color options tailwind has e.g bg-indigo-400 etc

bikeshaving

The title of the blog post mentions Tailwind Plus so I’m assuming it’s a paid feature. The ambiguity is probably intentional.

Alupis

It's not very expensive, all things considered. $299 for a single-user perpetual license (includes all future updates too) or about $1k for a team license[1].

If it saves you a bunch of time writing and maintaining the sort of components they are showing off, probably worth it?

[1] https://tailwindcss.com/plus#pricing

adamwathan

Thanks! It's a paid feature because we just spent around $250,000 developing the library. Couldn't have built it if we were just going to give it away and maintain it forever for free, our engineers are talented people and deservingly well-paid.

benatkin

Another hilariously paid feature is https://sso.tax/

It's funny because they're unintuitive to their end users. However, that is deliberate - they are looking for a decision point that comes after, but not too long after, devs have heavily invested in the product.

hbn

Yeah this seems like an odd thing to paywall. In the web dev world where everything is free, it's a pretty crazy ask to ask people to tie themselves to a UI framework where I guess you're forever paying a subscription just to continue using the framework?

It's like putting if postgres expected you to pay them a monthly fee.

edit: I see now their pricing is one-time perpetual access. Still, I'm genuinely curious how well this model works.

abtinf

> I guess you're forever paying a subscription just to continue using the framework

It's a one-time fee for unlimited use and lifetime updates, not a subscription.

null

[deleted]

bitbasher

Seems like this is a move to remove alpinejs from the custom block elements in tailwindcss plus? I don't see alpinejs in the code snippets anymore.

edit:

Confirmed, they removed alpine from their copy/pastable code. Now you see:

<!-- Include this script tag or install `@tailwindplus/elements` via npm: -->

<!-- <script src="https://cdn.jsdelivr.net/npm/@tailwindplus/elements@1" type="module"></script> -->

This sucks because I have been using alpine and now I can't copy paste the examples ~_~

rafram

> You can even build something as sophisticated as a custom command palette with Elements

Well, yeah, because they added an `<el-command-palette>` that specifically does that.

dandano

Tailwind plus has saved me 100s of hours for my rails based development. JS was the only thing missing for me, so stoked for this.

joduplessis

I've been working with TW more lately and I must admit - there is a convenience factor there that is really nice - and it abstracts a lot of the finicky design system thinking.

But, if you're building any long-term product, investing in your own design system + component library will put many many more miles on the board in terms of DX, flexibility, aesthethic language, dependency footprint, etc.

pzo

Wish there was something like that for React Native or even Lynx. Then I would happily pay for plus bundle.