Logo
AndreaDSW
BETA

Experimenting Tailwind CSS in Design Systems

Last Modified:

A deep dive into using Tailwind CSS for building scalable and maintainable design systems.

I started to rebuild my personal website when I came across Tailwind CSS, developed by Adam Wathan. Tailwind is known as “utility-first” CSS. It provides a single-purpose class which does one specific task. This single class can be combined with multiple single classes to get the outcome that you want to.

For instance, if you want to create a button, you can write bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded.

bg-blue-500 - set a blue background colour. hover:bg-blue-700 - set the background colour to change when hovering over the button. text-white - set a white text colour. font-bold - set a bold font. py-2 - set padding y axis (top and bottom). px-4 - set padding x axis (left and right). rounded - set round borders.

Tailwind gives more flexibility to build anything due to the very minimum block. However, if you don’t have a component library to work with Tailwind, it will demand you spend more time to build a component library. The Tailwind offers a bear bone LEGO block, not ready-made components. From one piece you need to build a component to add on your website. One big advantage is that you can build any website with a free look in terms of layout and design.

I use a hybrid approach combining Tailwind with Radix UI, a UI library built into React. Radix UI offers “headless components” fully functional and accessible with zero styling. Including accessibility complied with WCAG (Web Compliance Accessibility Guidelines), keyboard navigation and complex interactive behaviour. This chosen stack is considered a professional to build modern and accessible web applications.

This note is a brief from my experimental use of Tailwind version 3.4 - for fully understanding of this framework, check out the Tailwind documentation, https://tailwindcss.com/docs/ (opens in a new tab)