I wish the author would also put up a purchase page on https://themeforest.net/ . I dont mind optionally paying for it - especially a nicely packaged starter for nextjs, etc
DaisyUI is beautifully written. This can be the kit with a boatload of work done for you. Think like Bootstrap but better with Tailwind. You can use this to teach how to write well thought-out CSS codes, separation, and extensibility.
TailwindUI is more like Bourbon[1] (was my go-to Sass tool) but on the structural interfaces done for you. I'm standardizing out Web, WebApps, and marketing materials to start with TailwindUI. Someone with good chop of CSS/Tailwind won't likely need to use TailwinUI but it can be a fast tool for teams. It is highly extensible but also has the double-edge sword criteria that a rookie can just keep copy-pasting, repeating codes and still work (not a good thing).
Will we use DaisyUI for the team? Unlikely!
Will I use it for some quick but still larger project, marketing page? I might very likely.
I’m not saying this is ugly but the visual execution of some of these components is poor. No good usage of padding in some examples, poor ratios between the typography and the containers, inconsistent use of different line widths and border radius, weird and incosistent design choices in spacing and proportions…
I mean. This looks alright and it will certainly make any UI look pretty decent, but the execution is not superb like the actual TailwindUI library which is incredibly well thought from a visual design perspective. Those components are perhaps less shiny than these but they are incredibly functional and way more intentional.
This is a good effort though and I hope to see it improving.
I think it is not a fair comparison with the Tailwind UI where there's probably more than one person doing the work plus the whole expertise of the actual Tailwind authors in the mix.
If you are able to observe what is severely lacking in this implementation, I am pretty sure that the Github author would welcome your suggestions / comments / PRs and any contribution to make this better.
For a start, this is actually good (enough).
In the same vein that TailwindUI is still continuing to evolve as the maintainers are finding optimization to make it better.
Totally agree and I mean it with no animosity. As an adopter of Tailwind, I really want to see more of these components kits and for the exisiting ones to keep improving.
Back when Bootstrap 2 was the most popular UI library one of the biggest problems with it was that the defaults were good enough that no one changed them, and consequently every SaaS startup's product looked the same for about 5 years. Pushing people to tweak things while still giving them a solid foundation is a good thing.
I'm not saying that's necessarily the case here, but there is a strong argument in favor of not making the default theme for a UI library look perfect.
> the defaults were good enough that no one changed them, and consequently every SaaS startup's product looked the same for about 5 years
Sounds like native GUI experience on Mac or Windows for quite some time, then? I'm certainly not offended when all buttons look the same. At least I immediately know that they're buttons.
This sort of stuff was difficult to figure out when I was learning HTML/CSS, do you know of any guides which list similar rules and how to make "proper" use of properties like borders, padding, typography etc?
Refactoring UI [1] is a good place (from the guys behind Tailwind) - admittedly I've drunk the Tailwind koolaid, but there are some useful tips on
there from a designer POV
Unrelated tangent: I'm always frustrated when I see a recommendation for a book only to go and look it up and find that it's actually an "ebook" (in this case PDF).
Not to make a value judgement on ebooks, but I just really like physical books sometimes - if it was on Amazon I likely would have bought it.
Again, not a value judgement on the content - I'm sure it's great (I'm a paid and happy user of TailwindUI)
The Non-Designer's Design Book is the best resource I know of for learning general design guidelines, which apply to what you're asking. I've bought this book for many developers and they've all loved it.
You could refine them, group the points and put up a blog post (or a GitHub page) and share that here (as its own submission). If it’s with visual examples, all the more better. I’m sure somebody will find it useful.
This stuff all falls under the umbrella of “design”. One thing that helped me a ton was the articles at https://learnui.design - especially the 2-part “Rules for Designing Gorgeous UI”. The course itself is also excellent.
I agree that there is room for improvement - though I think it's not a bad V1 at all.
A lot of the products I see turning up on Show HN would look infinitely better if they used this library. (The ones where UI design is clearly not the solo-developer's strength).
This is a very nice step in making Tailwind more Bootstrap like (read beginner friendly). One common complaint about Tailwind is that it makes the HTML look very full (full of classes).
so why not just use bootstrap? I'm new to web development, but I thought the whole point of TailwindCSS is that it is more customisable than Bootstrap.
What if you as a beginner can start using Tailwind immediately with this library and can learn tailwind's utility classes at your own pace when you need to customize anything?
I'm not sure about this path, but it might be good for a beginner.
If it's just one class per property, you could just type out the CSS. Using emmet in IDE is probably faster than finding the tailwind classes with autocomplete.
>If it's just one class per property, you could just type out the CSS.
You can, but then it rarely happens that you want the CSS to be fixed in that way for all time: the brilliance of tailwind is that you get resposniveness just by adding a few more classes. You cannot do that with inline CSS.
This is the one pro-tailwind argument I can agree with. Sometimes I’ll use their shorthand md: & sm: in @apply in place of media queries. The advantage is that they remain local to their relevant selectors.
Makes me think- all I would really want is to be able to have multiple values in css. Maybe something like .
I agree with the positive sentiment, but a cynical take might be that we've basically found our way back, traveling in a circular pattern.
It looks like Tailwind and Tachyons are useful tools but they do have a sweet spot, and I've run into the annoyance of 20+ classes in my tiny projects as well. Descriptive
Real changes to the landscape have been made along the way:
- Flexbox and to a lesser extent grid are grokked by many
- People are much more willing and able to use CSS variables
- Shadow DOM encapsulation and other methods of isolating styles from one component to another are well explored
- there's some stuff on the horizon where people are JITing here and there and writing custom compositors ("Houdini" and related tech)
But I'm not sure there have been any large paradigm shifts in CSS over the last 10 years, and Tailwind no matter how successful it's been commercially and in the headspace of developers seems to have been largely a very useful somewhat passing obsession.
I see this not as a replacement, but as a novice choice. As noted in the documentation, you can use tailwind classes to customize existing components but if you do not want to you can use it like bootstrap. Even for building a quick prototype which can be made to look good in future is a use case for this.
I want to note that I was talking about tailwind vs bootstrap and others in the abstract, less so about DaisyUI specifically.
What lead me to make the comment was the discussion point that "btn btn-primary" was so much more useful than 20+ tailwind classes. I agreed (it's something I have come across as well), but
It's clear that Daisy UI will get you up and running quickly and there are lots of similar projects out there that do things like this, but the meta discussion around whether we're going in circles or if we've actually moved forward and found a nice mix between what was the bootstrap style (1-2 classes that do all the work) and tailwind/tachyons (5-10+ classes that do the work).
To make the discussion less meta -- is the future things like DaisyUI? Bootstrap like classes but with the outlet for overriding not being manual CSS but actually being tailwind-style classes? In the past it was Bootstrap + your special large class/baked in styles, but in the future maybe it's "btn btn-primary box-shadow" or whatever, clearly a middle point of sorts
I tend to use it with some sort of component system - vue/react/svelte - so writing the classes out once doesn't bother me.
I actually like it, as looking at the code I can see exactly what it does. 'btn-primary' doesn't convey anything to me. 'rounded text-sm font-bold py-2 px-3 bg-indigo-300' I know exactly what that is going to look like.
I also appreciate the removal of classes not needed if using a build step - much nicer to have a small css file that has exactly what you use, rather than a bootstrap style kitchen sink
I'm not a frontend developer so I've been watching this from the outside over the years of reading HN.
The impression I got is that Tailwind is essentially CSS 2.0 with warts ironed out (sorry for the unpleasant mixed metaphor):
A) CSS / Tailwind: lots of little 'atomic' classes describing individual visual properties. Easy to understand, easy to customize, but slow to read, slow to get started, with plenty of stuff to learn
B) CSS frameworks / Tailwind components: fewer classes declaratively describing the component's role (eg 'btn-primary'). Quick to get started, elegant to read, but prone to abstraction leakage and trickier to bend to your own exact specifications
There's always been a need for both kind of tools for different projects, in the same way that e.g. network programming may involve anything from bit-banging commands to high-level protocols.
Over the years CSS frameworks kept improving, but CSS was much slower to do so - although it acquired flexbox, grid, etc., the language limitations stayed, and they were bad enough to spawn SASS/LESS out of a genuine need.
Tailwind saw a ton of hype and adoption because all the developers who had always wanted to go the (A) road now had a well-designed set of simple classes they could use with a lot fewer footguns, plus a bunch of developers who had adopted (B) because it was the road that had all the momentum suddenly realized that they probably wanted to use (A) once it was made less painful.
DaisyUI and similar projects don't do anything that Bootstrap didn't do for CSS, but by building on top of Tailwind it means that, when your project or resources grow and you want to move from (B) to fully customizing your style in (A), you will be able to write your individual little graphic touches in Tailwind instead of plain CSS.
Why? A “create” button that takes you to a creation page is still a link to that page and should be a link. It looking like a button indicates an action that the user understands. It is accessible, semantically correct, and follows accepted design conventions. What is the problem?
Because there's an expected built-in behaviour to these elements.
> It is accessible, semantically correct, and follows accepted design conventions.
There's nothing accepted about disguising a link as a button. Especially when it literally does no action except, you know, linking to a different page.
Though, of course, there are ambiguous situations, especially in the context of PWAs. But code examples are not an ambiguous situation.
I think that ship has sailed, I really don't think that average users expect a button to 'do something' (in the sense it submits a form or something).
Going to a different page /is/ 'doing something' as far as users are concerned. Certainly not the internet of old where a form was a form, and a link was a link.
An average user has no idea what's going on in modern software anymore, to be honest. Nothing is what it seems and is redesigned every couple of months
There is a substantial difference between these two links. One takes you to a location, the other one starts a process which ends with an action.
As a user you are not going to be clicking the “New” button everyday. Maybe once a month, maybe once a year. So you are likely not going to remember where it is from the last time you clicked it. If you don’t find it when you need it, you will get frustrated. It needs a lot of visual weight relative to the other links in this nav section. Giving the same weight as a button is a reasonable decision.
Eh, unless an app is a SPA (where you attach event handlers to buttons to run client side validation or something like that) it’s way simpler to have a form route to another resource via a link. But users think of them more as actions than links, so its perfectly reasonable to disguise a link as a button.
edit: I said “form”, but I meant page. Forms actually use buttons!
With Tailwind, if you write out something like that more than once or twice, you're really supposed to bundle it together. Either as a plain CSS class, or a component in your framework of choice.
I suppose a library of common elements is a good thing to have, but the reason I like Tailwind is that I can use the utilities at first and then easily gather them together as plain CSS classes as and when that makes sense to me.
Yes, the way I use it is with Svelte. I've created a list of components in Svelte (buttons, links, dropdowns, tables, etc.) I think with how tailwind makes you html look (very full of classes), it is perfectly matched with a component based framework.
That way you get the full tailwind experience without the tedious rewriting of components.
Whenever I read a comment like this I feel like talking to someone who’s never used Tailwind nor written inline CSS. How do you write inline CSS for pseudo-classes like :hover, :focus, :disabled? Media queries for breakpoints and dark mode? Not to mention more advanced features like divide-, space-, group-hover:, etc.
1) A set of a classes with consistent names for scales, colours, etc. You're not working with hex codes or pixel values. It's a more writable and much more readable syntax than inline styles.
2) It has variants for hover, etc (e.g.: class="bg-black hover:bg-white"). AFAIK you can't do that with inline styles.
3) I find it plays nicely with a workflow where I start out not knowing exactly what I'm doing, which is almost all of the time. I can smash ahead and do things in the class="" of each tag, then as I notice that I'm repeating myself, I grab small chunks of the class list and put them in '@apply's in a CSS file. Bottom-up, liek.
The class lists are just a lot more manageable than inline styles. They're copy-pastable and really easy to read when you get used to it, as long as the lists aren't too long.
Because you don't have to use it in a component system.
It's not a case of hiding it away, it just has a system for building your own css library kind of thing if you want to
As others commented, inline CSS has downsides. But there are libraries out there that allow you to write a block of CSS alongside your component that are neatly packaged into a CSS file, like Styled Components (https://styled-components.com/).
a very underrated feature of Tailwind is it's excellent documentation with immediate search. Want italic text? In straight CSS, how long will it take to look up is it font-style: italic; or text-style: italic or text-italic: true ? Tailwind's docs make it virtually instant. Even more impressive with flex and grid layouts (is it justify-items or align-items, etc). I find that Tailwind reduces the time from "idea in brain" to "implemented on page" by about 90%, now multiply that by dozens or hundreds of individual page elements. (to be fair, I don't do a ton of front end so I forget the CSS syntax quite often)
What's the point in spending 20 hours learning some custom interface that's only used in like 5% of projects and will probably be gone in 5 years, when you could spend 30 hours learning the standard that's been around for decades and understand every library for years to come?
I never sat down for hours to learn it. I just started using it. Most of the classes were very intuitive with a working knowledge of the box model. For anything else I just searched the docs or even better, got the VSCode plugin to suggest the correct one
It's not a custom interface. It's just classes. It's got a type of syntax, sure, especially for media queries but it's not much different than "learning" the classes from bootstrap
It's literally just CSS but abstracted as convenient classes as the name "utility classes" implies already. I don't understand why people keep telling others to learn CSS instead. I also hate dealing and writing CSS cause it's cumbersome and unwieldy and this is a much better way of styling my HTML and getting immediate feedback
Well for one you cannot use all CSS features inline, some of them are pretty important. Then there are also bad performance implications of using pure inline styles.
But in terms of structuring your code, there are related concepts in other areas of programming:
The most general concept applied here is stratification or layering. You want to decompose your code into more general pieces so you can use those pieces to compose the actual solutions.
Example: Say you wanted to write a compiler. It typically much easier to simplify, AKA decompose the compiler into a scanner, parser, analyzer, optimizer, emitter etc. The users of your compiler probably don't care that you decomposed and layered your code. But you do care, since you can reason about your code in terms of small/local problems. Maybe you don't stop there. Your scanner can be stratified further, so you can easily build evolve and reason about it.
This is the primary thing these types of libraries do. They give you generalized building blocks that have compositional semantics that make sense. You can use their sane defaults or generate them from scratch using a design system.
Secondly the atoms are discretely defined. You're not dealing with all possible values for each property but with sets that you can join/compose. The generated classes have this little mini-syntax that you first need to get used to a bit, but after a while you'll easily remember the prefix schema of your classes (Tailwind's documentation site is also very well made). Tailwind cross joins the atoms for you, but then also deletes all the classes you didn't use in your project.
For those wishing to learn the intricacies and beauty of Tailwind, this is a good source. Well written code but might lack the finesse of design. Then use TailwindUI[1] as a kit for your design/frontend team.
Oh I pray that I remember this website next time I'm looking for an HTML/css template. Great job, this UI looks so polished and is as modern as it gets.
(NOTE: I did not WickedBlocks/WickedTemplates -- it's the awesome work of the folks over at WickedTemplates https://wickedtemplates.com, which they shared on HN I believe a while back)
I'm actually working on a little side project right now where I turn wickedblocks into a set of usable native web components (as in drop an <import> tag and the component on your page and you're off to the races), because I think that's a much more composable way to use these snippets copy & pasting HTML, looks like Daisy needs to be next.
[EDIT] A bit annoying to others probably to drop a lede and I have no idea when I'll get done and publish it with the blog post so if someone just wants to see the code:
If anyone wants to contribute a snazzy icon I'd love to take it! There's no landing page to showcase it yet but there's files like lg-left-header/index.html[0] which showcase usage and the intended simplicity.
Obviously if you're trying to get started, use the blocks as they're presented and the awesome work done by WickedTemplates (they've also got some ready-to-go straight out of the box templates and other stuff for you to use on their main site!), but if you're interested in lit[1]-powered drop-in components, follow that space.
[EDIT2] - For those taking a look at the code, note that there are like... 4 variants of the left-header component. Half of the time spent getting this out (it's all simple in theory -- just copy + paste and swap out static text for variables) was figuring out which parts to unify and which parts to keep separate for easy drop-in use. There's not much there yet, but it's more a matter of me finding time to sit down and make these decisions for every kind of component on the wickedblocks page.
There are some concerns like i18n that I've punted on by just making sure that all static text were component inputs, but ideally integration with browser-supported i18n[2] is the proper way to do things in a minimal but standards compliant way.
[EDIT3] - Added note to make it clear I didn't create WickedBlocks/WickedTemplates
I am more impressed by the landing page than the actual components. Is anyone aware of a good component library for landing/marketing pages for Tailwind?
There are toolkits like https://frontendor.com but they all follow the 5-10 year old "theme" of insanely packed content you had seen on SaaS pages some years ago. Together with many photographs or flat humans... I can't find anything with "new" approach which uses more padding, much more detail to typography, bigger fonts etc. shown very good on the https://tailwindcss.com landing page. Or any hint where all the new startups get their designers for these new fresh layouts?
I must be getting old because I literally don't get front end devs these days...
The landing page is like a few divs with some position centres. What would you even use a "component library" for in this case? The only thing on the entire page with any complexity whatsoever are the component demos (which are obviously part of this DaisyUI thing itself) and the code blocks/syntax highlighting, which I'm sure there's a billion libraries for already.
I'm really struggling to come up with any sort of other dependency that would help me build that page any faster than just opening the text editor and shitting out some HTML and CSS.
Do people just spend so much time working with Bootstrap and whatever other cruft that they just never bother to learn the basics?
At this level of simplicity and for churning out marketing pages where you don't care about maintainability, you're probably better off looking for a WYSIWYG editor rather than a library.
Interesting side effects of css utility frameworks: I was trying to scrape a website that uses tailwind this week and it’s really difficult, as nothing had a unique class name.
It is also an effect of various css-in-js shit, you can't know what the element does if it doesn't have a tooltip. Because now the class name is gibberish.
That's not very nice, maintainability suffers in the same way. You can obfuscate your classes later on.
But alas, the battle for semantic css has already been lost and the community keep going in the opposite way (first bootstrap, which was halfway through, now tailwind which is basically inline styles with variables).
My goodness Bootstrap, how far ahead of your time you were. To this day we copy you, god bless you m’lord.
Nope, I reject this. We should be so much farther ahead than this. It’s the garbage fullstack developers that need this crap to make a good ui. They don’t belong on the frontend, and I’m pretty tired of it.
Our UI/UX will get shittier and shittier if we coddle this group.
DaisyUI is a great starting point but it is missing a lot to make it functional and then you end up recreating the wheel.
I agree with some comments that it is lacking that wow factor that TailwindUI has.
I'm working on https://versoly.com/ which is a Tailwind Website builder and have ran into a bunch of issues with Tailwind when it comes to building static sites.
I love that Bootstrap offer "btn btn-primary" and it makes it very easy to keep a consistent site.
For Tailwind to take off it needs
- A list of components (maybe 20 ish, buttons, tabs, navbars being the main ones)
- JS for components
- Container system (I have built one that works similar to Bootstrap and makes it much easier to create responsive layouts quickly)
Once those core parts have been built I believe developers will create more advanced libraries such as lightboxes etc which will save even more time.
But I talk with a lot of full stack and backend developers who still use Bootstrap. They even own TailwindUI and other templates but stick to Bootstrap.
That to me means there is a big issue with Tailwind and the developer experience.
Once solved Tailwind will grow even faster and help more developers/companies.
That page broke tabbing through interactive elements by using nested focussable elements like this:
<div tabindex="0"><input ...></div>
Because of that, it is sometimes necessary to tab twice to focus the next element. Not sure whether that is a problem of DaisyUI in general or just their website. But it is definitely annoying.
I tried using Tailwind, but I just couldn’t get into it. It’s like having to learn CSS all over again because the classnames do not map 1-1 with their respective properties, and autocomplete is lacking.
Conversely, Chakra UI Box, which does more or less the same thing is super easy to get into.
This looks nice, but I kind of feel like we’ve come full circle two full times to get to this point.
Very welcome. Sometimes the amount of classes needed in Tailwind is enormous.
I paid for the TailwindUI pack too. But as nice as Tailwind is, the guys who built TailwindUI don't really get or understand a lot of real-world design patterns.
A lot of stuff in there is needlessly complicated. Our team end up trimming down things to 50% of the markup that they use, while retaining full responsiveness.
Overuse of flex for simple paradigms is a constant complaint of mine.
Hope DaisyUI improves Tailwind in some way.
Anyway... sorry to get sidetracked on a sidebar.. lol.
> the guys who built TailwindUI don't really get or understand a lot of real-world design patterns
It's all relative. It's clear they understand more than I do, and I'm not a terrible UI designer, so paying for TailwindUI has been a no-brainer in terms of the value delivered to my projects so far.
I would suggest the use of convention like SuitCss for your custom component classes so you can lint them thoroughly to ensure low specificity.
I would recommend to use a prefix on your custom classes, to "namespace" them. "btn" is far too generic. This can even be linted by eg. postcss-bem-linter.
Exactly. I paid for TailwindUI too but have been disappointed by the execution in code. I love the visual design, but give me some abstractions and not 20 classes per element.
I believe in semantic class-names, I know one can transform tailwind into cleaner markup but it seems to introduce more work than just building from scratch
So I don't understand. People are complaining about bootstrap for defaults. Then daisyui has great defaults, and the same class names. I see no reason to customize daisy.
That page is extremely slow without hardware acceleration.
It (hw-accel) was off for me because I updated some things without restarting Chromium, but I dunno. It doesn't "spark joy" with me.
I am seeing that also. Continuously used ~50% of my 2015 Macbook Pro's discrete GPU and caused the system fans to kick off, just looking at the components on the landing page.
This library highlights the biggest issue of tailwind for me.
> Clean HTML
The rest of your code will still use bunch of shitty tailwind shortcuts that are really chaotic the moment you build something more than a simplest component.
I mentioned it in another comment, but I felt the same way until I figured out there is a solution. Here is an example of a simple CSS file with a reusable button class:
I can now just give all of my reusable buttons the ".button" class instead of the giant string above. I can even add more styles or overwrite existing styles to give it a different look such as:
173 comments
[ 3.1 ms ] story [ 217 ms ] threadI wish the author would also put up a purchase page on https://themeforest.net/ . I dont mind optionally paying for it - especially a nicely packaged starter for nextjs, etc
DaisyUI is beautifully written. This can be the kit with a boatload of work done for you. Think like Bootstrap but better with Tailwind. You can use this to teach how to write well thought-out CSS codes, separation, and extensibility.
TailwindUI is more like Bourbon[1] (was my go-to Sass tool) but on the structural interfaces done for you. I'm standardizing out Web, WebApps, and marketing materials to start with TailwindUI. Someone with good chop of CSS/Tailwind won't likely need to use TailwinUI but it can be a fast tool for teams. It is highly extensible but also has the double-edge sword criteria that a rookie can just keep copy-pasting, repeating codes and still work (not a good thing).
Will we use DaisyUI for the team? Unlikely!
Will I use it for some quick but still larger project, marketing page? I might very likely.
1. https://www.bourbon.io
Tailwind UI is great! ( please note that I a primarily a backend dev with limited knowledge of CSS )
Looking forward to explore DaisyUI soon !
I mean. This looks alright and it will certainly make any UI look pretty decent, but the execution is not superb like the actual TailwindUI library which is incredibly well thought from a visual design perspective. Those components are perhaps less shiny than these but they are incredibly functional and way more intentional.
This is a good effort though and I hope to see it improving.
If you are able to observe what is severely lacking in this implementation, I am pretty sure that the Github author would welcome your suggestions / comments / PRs and any contribution to make this better.
For a start, this is actually good (enough).
In the same vein that TailwindUI is still continuing to evolve as the maintainers are finding optimization to make it better.
I'm not saying that's necessarily the case here, but there is a strong argument in favor of not making the default theme for a UI library look perfect.
Sounds like native GUI experience on Mac or Windows for quite some time, then? I'm certainly not offended when all buttons look the same. At least I immediately know that they're buttons.
[1] https://www.refactoringui.com/
Not to make a value judgement on ebooks, but I just really like physical books sometimes - if it was on Amazon I likely would have bought it.
Again, not a value judgement on the content - I'm sure it's great (I'm a paid and happy user of TailwindUI)
https://tailwindui.com/pricing
A lot of the products I see turning up on Show HN would look infinitely better if they used this library. (The ones where UI design is clearly not the solo-developer's strength).
A very good example on OP's website for a button:
Using tailwind:
Using daisy: Although I personally think that the corners at a bit too rounded by default, giving it a very amateur look but I think you can customize that.But a very promising project indeed.
I'm not sure about this path, but it might be good for a beginner.
Both libraries have pros and cons.
If you want to do in "raw" tailwind (i.e. without this component library), you can use layers to create your own component classes, e.g.:
You can, but then it rarely happens that you want the CSS to be fixed in that way for all time: the brilliance of tailwind is that you get resposniveness just by adding a few more classes. You cannot do that with inline CSS.
Makes me think- all I would really want is to be able to have multiple values in css. Maybe something like .
.card { width: 5rem md: 10rem; }
Snap… am I on to something?
It looks like Tailwind and Tachyons are useful tools but they do have a sweet spot, and I've run into the annoyance of 20+ classes in my tiny projects as well. Descriptive
Real changes to the landscape have been made along the way:
- Flexbox and to a lesser extent grid are grokked by many
- People are much more willing and able to use CSS variables
- Shadow DOM encapsulation and other methods of isolating styles from one component to another are well explored
- there's some stuff on the horizon where people are JITing here and there and writing custom compositors ("Houdini" and related tech)
But I'm not sure there have been any large paradigm shifts in CSS over the last 10 years, and Tailwind no matter how successful it's been commercially and in the headspace of developers seems to have been largely a very useful somewhat passing obsession.
What lead me to make the comment was the discussion point that "btn btn-primary" was so much more useful than 20+ tailwind classes. I agreed (it's something I have come across as well), but
It's clear that Daisy UI will get you up and running quickly and there are lots of similar projects out there that do things like this, but the meta discussion around whether we're going in circles or if we've actually moved forward and found a nice mix between what was the bootstrap style (1-2 classes that do all the work) and tailwind/tachyons (5-10+ classes that do the work).
To make the discussion less meta -- is the future things like DaisyUI? Bootstrap like classes but with the outlet for overriding not being manual CSS but actually being tailwind-style classes? In the past it was Bootstrap + your special large class/baked in styles, but in the future maybe it's "btn btn-primary box-shadow" or whatever, clearly a middle point of sorts
I actually like it, as looking at the code I can see exactly what it does. 'btn-primary' doesn't convey anything to me. 'rounded text-sm font-bold py-2 px-3 bg-indigo-300' I know exactly what that is going to look like.
I also appreciate the removal of classes not needed if using a build step - much nicer to have a small css file that has exactly what you use, rather than a bootstrap style kitchen sink
The impression I got is that Tailwind is essentially CSS 2.0 with warts ironed out (sorry for the unpleasant mixed metaphor):
A) CSS / Tailwind: lots of little 'atomic' classes describing individual visual properties. Easy to understand, easy to customize, but slow to read, slow to get started, with plenty of stuff to learn
B) CSS frameworks / Tailwind components: fewer classes declaratively describing the component's role (eg 'btn-primary'). Quick to get started, elegant to read, but prone to abstraction leakage and trickier to bend to your own exact specifications
There's always been a need for both kind of tools for different projects, in the same way that e.g. network programming may involve anything from bit-banging commands to high-level protocols.
Over the years CSS frameworks kept improving, but CSS was much slower to do so - although it acquired flexbox, grid, etc., the language limitations stayed, and they were bad enough to spawn SASS/LESS out of a genuine need.
Tailwind saw a ton of hype and adoption because all the developers who had always wanted to go the (A) road now had a well-designed set of simple classes they could use with a lot fewer footguns, plus a bunch of developers who had adopted (B) because it was the road that had all the momentum suddenly realized that they probably wanted to use (A) once it was made less painful.
DaisyUI and similar projects don't do anything that Bootstrap didn't do for CSS, but by building on top of Tailwind it means that, when your project or resources grow and you want to move from (B) to fully customizing your style in (A), you will be able to write your individual little graphic touches in Tailwind instead of plain CSS.
Because there's an expected built-in behaviour to these elements.
> It is accessible, semantically correct, and follows accepted design conventions.
There's nothing accepted about disguising a link as a button. Especially when it literally does no action except, you know, linking to a different page.
Though, of course, there are ambiguous situations, especially in the context of PWAs. But code examples are not an ambiguous situation.
As a user you are not going to be clicking the “New” button everyday. Maybe once a month, maybe once a year. So you are likely not going to remember where it is from the last time you clicked it. If you don’t find it when you need it, you will get frustrated. It needs a lot of visual weight relative to the other links in this nav section. Giving the same weight as a button is a reasonable decision.
edit: I said “form”, but I meant page. Forms actually use buttons!
I suppose a library of common elements is a good thing to have, but the reason I like Tailwind is that I can use the utilities at first and then easily gather them together as plain CSS classes as and when that makes sense to me.
That way you get the full tailwind experience without the tedious rewriting of components.
2) It has variants for hover, etc (e.g.: class="bg-black hover:bg-white"). AFAIK you can't do that with inline styles.
3) I find it plays nicely with a workflow where I start out not knowing exactly what I'm doing, which is almost all of the time. I can smash ahead and do things in the class="" of each tag, then as I notice that I'm repeating myself, I grab small chunks of the class list and put them in '@apply's in a CSS file. Bottom-up, liek.
The class lists are just a lot more manageable than inline styles. They're copy-pastable and really easy to read when you get used to it, as long as the lists aren't too long.
What's the point in spending 20 hours learning some custom interface that's only used in like 5% of projects and will probably be gone in 5 years, when you could spend 30 hours learning the standard that's been around for decades and understand every library for years to come?
Just learn CSS, it's not that hard.
I never sat down for hours to learn it. I just started using it. Most of the classes were very intuitive with a working knowledge of the box model. For anything else I just searched the docs or even better, got the VSCode plugin to suggest the correct one
It's not a custom interface. It's just classes. It's got a type of syntax, sure, especially for media queries but it's not much different than "learning" the classes from bootstrap
It's literally just CSS but abstracted as convenient classes as the name "utility classes" implies already. I don't understand why people keep telling others to learn CSS instead. I also hate dealing and writing CSS cause it's cumbersome and unwieldy and this is a much better way of styling my HTML and getting immediate feedback
https://frontstuff.io/no-utility-classes-arent-the-same-as-i...
But in terms of structuring your code, there are related concepts in other areas of programming:
The most general concept applied here is stratification or layering. You want to decompose your code into more general pieces so you can use those pieces to compose the actual solutions.
Example: Say you wanted to write a compiler. It typically much easier to simplify, AKA decompose the compiler into a scanner, parser, analyzer, optimizer, emitter etc. The users of your compiler probably don't care that you decomposed and layered your code. But you do care, since you can reason about your code in terms of small/local problems. Maybe you don't stop there. Your scanner can be stratified further, so you can easily build evolve and reason about it.
This is the primary thing these types of libraries do. They give you generalized building blocks that have compositional semantics that make sense. You can use their sane defaults or generate them from scratch using a design system.
Secondly the atoms are discretely defined. You're not dealing with all possible values for each property but with sets that you can join/compose. The generated classes have this little mini-syntax that you first need to get used to a bit, but after a while you'll easily remember the prefix schema of your classes (Tailwind's documentation site is also very well made). Tailwind cross joins the atoms for you, but then also deletes all the classes you didn't use in your project.
1. https://tailwindui.com
(NOTE: I did not WickedBlocks/WickedTemplates -- it's the awesome work of the folks over at WickedTemplates https://wickedtemplates.com, which they shared on HN I believe a while back)
I'm actually working on a little side project right now where I turn wickedblocks into a set of usable native web components (as in drop an <import> tag and the component on your page and you're off to the races), because I think that's a much more composable way to use these snippets copy & pasting HTML, looks like Daisy needs to be next.
[EDIT] A bit annoying to others probably to drop a lede and I have no idea when I'll get done and publish it with the blog post so if someone just wants to see the code:
https://gitlab.com/mrman/landing-gear
If anyone wants to contribute a snazzy icon I'd love to take it! There's no landing page to showcase it yet but there's files like lg-left-header/index.html[0] which showcase usage and the intended simplicity.
Obviously if you're trying to get started, use the blocks as they're presented and the awesome work done by WickedTemplates (they've also got some ready-to-go straight out of the box templates and other stuff for you to use on their main site!), but if you're interested in lit[1]-powered drop-in components, follow that space.
[EDIT2] - For those taking a look at the code, note that there are like... 4 variants of the left-header component. Half of the time spent getting this out (it's all simple in theory -- just copy + paste and swap out static text for variables) was figuring out which parts to unify and which parts to keep separate for easy drop-in use. There's not much there yet, but it's more a matter of me finding time to sit down and make these decisions for every kind of component on the wickedblocks page.
There are some concerns like i18n that I've punted on by just making sure that all static text were component inputs, but ideally integration with browser-supported i18n[2] is the proper way to do things in a minimal but standards compliant way.
[EDIT3] - Added note to make it clear I didn't create WickedBlocks/WickedTemplates
[0]: https://gitlab.com/mrman/landing-gear/-/blob/main/lg-left-he...
[1]: https://lit.dev/
[2]: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
There are toolkits like https://frontendor.com but they all follow the 5-10 year old "theme" of insanely packed content you had seen on SaaS pages some years ago. Together with many photographs or flat humans... I can't find anything with "new" approach which uses more padding, much more detail to typography, bigger fonts etc. shown very good on the https://tailwindcss.com landing page. Or any hint where all the new startups get their designers for these new fresh layouts?
The landing page is like a few divs with some position centres. What would you even use a "component library" for in this case? The only thing on the entire page with any complexity whatsoever are the component demos (which are obviously part of this DaisyUI thing itself) and the code blocks/syntax highlighting, which I'm sure there's a billion libraries for already.
I'm really struggling to come up with any sort of other dependency that would help me build that page any faster than just opening the text editor and shitting out some HTML and CSS.
Do people just spend so much time working with Bootstrap and whatever other cruft that they just never bother to learn the basics?
At this level of simplicity and for churning out marketing pages where you don't care about maintainability, you're probably better off looking for a WYSIWYG editor rather than a library.
Or you could buy the Tailwind UI[2] - they add lots fairly often.
[1] https://github.com/aniftyco/awesome-tailwindcss [2] https://www.tailwindui.com
But alas, the battle for semantic css has already been lost and the community keep going in the opposite way (first bootstrap, which was halfway through, now tailwind which is basically inline styles with variables).
Nope, I reject this. We should be so much farther ahead than this. It’s the garbage fullstack developers that need this crap to make a good ui. They don’t belong on the frontend, and I’m pretty tired of it.
Our UI/UX will get shittier and shittier if we coddle this group.
I agree with some comments that it is lacking that wow factor that TailwindUI has.
I'm working on https://versoly.com/ which is a Tailwind Website builder and have ran into a bunch of issues with Tailwind when it comes to building static sites.
I love that Bootstrap offer "btn btn-primary" and it makes it very easy to keep a consistent site.
For Tailwind to take off it needs
- A list of components (maybe 20 ish, buttons, tabs, navbars being the main ones) - JS for components - Container system (I have built one that works similar to Bootstrap and makes it much easier to create responsive layouts quickly)
Once those core parts have been built I believe developers will create more advanced libraries such as lightboxes etc which will save even more time.
I'm a big fan of the new https://github.com/vuejs/petite-vue which is only 5kb and comes with a lot of power. Also combining it with something like https://github.com/CaptainCodeman/x-transition would be interesting.
I really want to see Tailwind grow so if you're interested in opensource or want to create paid UI kits feel free dm as I have a ton of ideas.
You have a lot higher standards than I about what "taking off" means :-D
But I talk with a lot of full stack and backend developers who still use Bootstrap. They even own TailwindUI and other templates but stick to Bootstrap.
That to me means there is a big issue with Tailwind and the developer experience.
Once solved Tailwind will grow even faster and help more developers/companies.
Conversely, Chakra UI Box, which does more or less the same thing is super easy to get into.
This looks nice, but I kind of feel like we’ve come full circle two full times to get to this point.
For autocomplete, have you seen https://tailwindcss.com/docs/editor-support ?
I use it in PHPStorm and VSCode and I get class name autocompletion just fine.
As a JIT mode user, the 1-1 naming would really be useful now.
I paid for the TailwindUI pack too. But as nice as Tailwind is, the guys who built TailwindUI don't really get or understand a lot of real-world design patterns.
A lot of stuff in there is needlessly complicated. Our team end up trimming down things to 50% of the markup that they use, while retaining full responsiveness.
Overuse of flex for simple paradigms is a constant complaint of mine.
Hope DaisyUI improves Tailwind in some way.
Anyway... sorry to get sidetracked on a sidebar.. lol.
I have to agree with this.
I did a review of Tailkit in general here: https://nickjanetakis.com/blog/reviewing-tailkit-300-tailwin...
It's all relative. It's clear they understand more than I do, and I'm not a terrible UI designer, so paying for TailwindUI has been a no-brainer in terms of the value delivered to my projects so far.
I would recommend to use a prefix on your custom classes, to "namespace" them. "btn" is far too generic. This can even be linted by eg. postcss-bem-linter.
TUI design + DaisyUI's abstractions is the dream.
> Clean HTML
The rest of your code will still use bunch of shitty tailwind shortcuts that are really chaotic the moment you build something more than a simplest component.