Hacker News new | ask | show | jobs
by trevor-e 326 days ago
I agree with others that this is not how Tailwind is meant to be used. For example, the approach shadcn (https://ui.shadcn.com/) takes is much better IMO.

Creating helpers like `btn` makes it very difficult to understand how it works and is not very customizable. Shadcn creates an actual component for you in your codebase and is just trivial Tailwind styles to modify.

3 comments

I tried shadcn and didn't like it. I don't want a new component in my source tree that I have to maintain.

For nearly everything, I won't need to customize it (and if I do have to customize often, it probably means that particular component library wasn't a good choice).

And for the rare cases where I do need to customize something, I can always go into the source of the component library, copy what I want out into my project, and edit it.

> this is not how Tailwind is meant to be used

Who cares? If it works, and makes the development process easier, and doesn't cause problems, then that's a good thing.

The problem I have with shad is that it’s react based, not HTML based.

So if I want to use shad, I can’t mix and match static HTML partials in with app code. To maintain a consistent theme, I would need to make literally everything react.

> I agree with others that this is not how Tailwind is meant to be used.

I mean, whatever it's "meant" to be used like, Tailwind is popular enough that it ends up being used in a lot places where how it's meant to be used is a terrible fit. (Big apps, with existing UI code, can't assume a monolithic technology stack, an actual design system with tokens that is not just a react component library, etc).

Ultimately, these are webapps and 99% of what we do ends up being the same shit over and over: "here's a button, here's a card", etc and all ends being like what DaisyUI, Bootstrap, etc offers and I'm glad DaisyUI is there to make Tailwind feasible for the people who are hot on it (don't realize it might not be a good fit for what they are doing.)

Yea sure, there are still some spots where I might find DaisyUI helpful, like building a quick internal admin page for something. And another commenter pointed out this works in non-react projects unlike shadcn. But I would know going into it that it will be a pain to customize/maintain, should I ever need to do that. Maybe that's already the expectation for people familiar with Bootstrap though.

My advice is more cautionary for folks who search "Tailwind components library", see DaisyUI as the 4th result, and think "great!"