Others
15 September 2021
Why Tailwind CSS
Tailwind CSS is one of the most famous utility-based front-end frameworks today. We’re sure that you’ve read this statement a dozen times on the internet now, so we’re here to summarize some key points that might give you some insight if you should actually give it a shot.
Here are some reasons why you should consider Tailwind CSS as your primary front-end framework:
Utility-first CSS
Respecting the Rule of least power, Tailwind CSS is actually easier to debug than other Non-CSS solutions where you have to go through your docs, Github issues, and so on for simple prototyping and debugging tasks. With Tailwind CSS, you know that either you’ve gotten the class right, or not. This seems like a small thing at first, but it actually lets you focus on what you should be doing rather than going through circles to fix something that can be dealt with in minutes with Tailwind. The class names in Tailwind CSS represent one or multiple CSS declarations. Hence, you get to build complex components from a set of primitive utilities in no time.
Consistency and readability
This might sound like a bad thing at first but hear us out first. The constrained set of primitive utilities also bound your creative capabilities but in a good way. You get a consistent style in your design that can become a signature. The Class names can be shared between elements so which also results in consistent bundle size. Not only does the CSS become easier to read, it fast tracks your workflow as the whole process becomes much quicker. And with writing faster styles, you get loads of pre-built classes for size and colors which also make it easier for other devs to learn the styles in a jiffy to get right on the project.
Reusability
With the CSS sharing elements and as the code grows in size, we can re-use the elements by making it a component and sharing it between elements. You get to reuse optimizable CSS for your elements. Generally, your fonts and colors are based on relative values but with Tailwind, you can darken your text by 5% or make the text smaller by 15%. The arbitrary values allow you to really get the little things right. Moreover, the real catch of small and composable utilities is the enforcement of consistency for every developer in the team as they have fixed options. So the design is unique yet consistent at the same time.
Responsive Design right in your browser
Tailwind lets you design right in your browser where you get to add transitions and even animations while you just play around. Prototyping and responsive design do not get any easier than this where you’re in control without the need of establishing a local host. The HTML is completely responsive in your browser, so you don’t have to go back and forth multiple windows to test a component through the eyes of an end-user. As a result, you cut out the tabbing between HTML & style sheets and fast-track your workflow resulting in quicker developer hand-off.
Design made easier for Devs
Tailwind has also emerged as a great solution for devs who like to focus on development. It makes it easy for them to drop in components and cook something up in no time. The one thing Tailwind does best is truly fast-tracking your workflow with the help of UI libraries of beautifully crafted components so they get to put all their attention to the development bits rather than getting stuck in the design process themselves or hiring a designer.
UI kits
There aren’t any built-in templates or components with Tailwind CSS like Bootstrap but here are several options available for every kind of dev. These UI kits have a variety of responsive components for you to have a solid base for your design. They enable you to achieve your requirements with proper responsiveness and very little code. Tailwind CSS is also known as the go-to, especially if you value customizability to a higher degree in responsive user interfaces. You can give the component a go right now with Doge build (a no-bullshit browser editor) and see how stuff looks in real-time.
Why not Tailwind
Tailwind CSS sure is a great solution for most devs who are familiar with CSS. There are some clear downsides too that we want to cover here. Firstly, complex animations do become a lot hectic. You can add complex animations through configurations but if your project needs a complex animation, it does backfire on your workflow. There’s a rigorous process of creating classes for each element. Although this can be solved with an animation library as Tailwind supports some pretty good ones out there.
Secondly, readability does become a bit tacky as you are adding loads of CSS classes. Especially when you’re getting the hang of things and you’re not familiar with the wide range of classes, readability is not a piece of cake when you’re starting out with Tailwind CSS.
Lastly and most importantly, Tailwind bears great fruits for devs and teams with their own design systems. There may be quite a few other considerations for big dev teams to make the switch from any other front-end solution that they currently have.
Conclusion
Tailwind CSS is a great low-level framework that solves many drawbacks of other CSS solutions. It does fast track the workflow for many devs but it’s not a solution for every web dev need out there. Front-End devs have the luxury to mesh different solutions as long as we guarantee maintainability, scalability, and performance. Tailwind does serve the purpose greatly for a great number of devs and provides a quicker approach to doing things seamlessly. Although, before adopting any new framework, it’s vital to factor in the effects on your workflow, productivity, performance, and scalability.