Vanilla JavaScript support for Tailwind Plus

(tailwindcss.com)

Comments

ricardobeat 15 hours ago

    <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.
judah 17 hours ago
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...

combyn8tor 13 hours ago
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.

abtinf 17 hours ago
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.

ayhanfuat 17 hours ago
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.
Imustaskforhelp 17 hours ago
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 18 hours ago
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.
bitbasher 16 hours ago
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 18 hours ago
> 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.

mediumsmart 1 hour ago
Vanilla HTML support is in the pipeline, hang in there.
joduplessis 7 hours ago
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.

dandano 4 hours ago
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.
jlukic 13 hours ago
Working on a new version of semantic ui for authoring ui with web components and signals based reactivity without a compilation step.

https://next.semantic-ui.com/

Has Tailwind support out of the box, just had to mod oxide to get non threaded wasm support in the browser

https://next.semantic-ui.com/examples/tailwind

jaesonaras 10 hours ago
I still can't justify using Tailwind. It's not that I don't like it, but I find CSS does everything I need and more, and I do some pretty complex styling and animations in CSS.

I just find that at some point, Tailwind gets in the way and I revert back to plain CSS. TW invariably then just becomes another style src in the HTML.

pzo 5 hours ago
Wish there was something like that for React Native or even Lynx. Then I would happily pay for plus bundle.
megaman821 15 hours ago
I am not a Tailwind user but I am a big fan of these "headless" web components. I have been using home-grown web components for tabs, modals, drawers, dropdown, tooltips, toasts and selects they implement functionality and accessibility with minimal styling. I use them across different projects and different solutions (Django templates, Vue, React, vanilla HTML) without any problems.
gnarbarian 10 hours ago
when a front end developer encounters a minor inconvenience he can't wait to avoid it by creating a series of larger ones.
paranoidxprod 18 hours ago
Would love to know how they went about implementing these. I always find custom elements interesting. I know the guys over at data-star.dev used one to implement their inspector element, but unfortunately that is also behind pro.

I know Lit is used a lot but I’m always looking for new approaches.

mmcclure 13 hours ago
I love seeing a mainstream/popular project embracing web components. We've been working on a web components project for media players[1] for a while for the same reasons:

    Instead of being coupled to a specific JavaScript framework, these custom elements work anywhere you can use a <script> tag
But...React is still the elephant in the room here. Maybe TW is just in a different world if they're truly just anticipating folks using this via a `<script>` tag, but if not, very curious how they're going to deal with some of the web component (WC) stuff we've dealt with, like:

- Despite signals/promises, React 19 didn't add full support for WC. React uses a diff algorithm for reconciliation. There are some rough edges for any "complex value" cases in the incomplete solution for 19's WC support with client vs server side rendering. This results in us being required to use 'use client' for parts of our component architectures, meaning WC providers aren't able to take full advantage of SSR.

- WCs are async loading, which in combination with React can have a negative impact on performance for things like core web vitals (and the dreaded cumulative layout shift).

- WCs are just different from React patterns. Each WC creates a DOM element, but React components don't have to, which just inherently means different shapes of code.

- React focus management libraries don't play nice with WCs. We've talked to multiple devs/companies that were excited about/using WCs that backed out because of cross-ecosystem complexities like this.

- React Native is, uh....a whole thing.

On a somewhat separate note...one of my complaints about TW historically has been that it feels like "just classes" (great!), yet requires a build step (oh...). I'm a little confused to see them leaning into `<script>` tags given that, so am I just missing something?

[1] https://github.com/muxinc/media-chrome

gedy 18 hours ago
Tailwind is fine, but I do find it humorous that they discourage wrapping up tw classes into a component class ala Bootstrap, but they wrap html up like this:

    <el-dropdown class="relative inline-block text-left">
      <button class="inline-flex w-full justify-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm ...">
        Options
      </button>
      <el-menu anchor="bottom end" popover class="w-56 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black/5 transition transition-discrete ...">
      ...
      </el-menu>
    </el-dropdown>

Bootstrap:

    <div class="dropdown">
      <button class="btn btn-secondary dropdown-toggle" type="button">
        Dropdown button
      </button>
      <ul class="dropdown-menu">
        ...
      </ul>
    </div>
(I realize you have full control over looks with TW, but Bootstrap and others have utility classes too for the common stuff.)
felipemesquita 16 hours ago
A love letter their rails users indeed. Congratulations to the tailwind team for shipping this! Disclosure
piyiotisk 17 hours ago
I would like to know how they find it in comparison to a framework like react
victorbjorklund 16 hours ago
Finally!
vFunct 18 hours ago
Would this work with DaisyUI components?
nodesocket 18 hours ago
I use DaisyUI in combination with Tailwind but it certainly has some JS backing.