Skip to main content

35 docs tagged with "tailwindcss"

View all tags

Advanced: Applying to Other Components

A chapter that applies the cva, cn, Slot, and design-token patterns learned with Button to Badge, Input, Card, and Alert. We summarize a pattern-selection guide per component and design best practices.

Animations

Animation implementation with Tailwind CSS. It organizes the basics of transition / duration / ease / delay, the scale / rotate / translate / skew transforms, v4 3D transforms (perspective / rotate-x/y/z), the built-in animate-* utilities, and motion-safe/reduce accessibility, all through implementation examples.

Backgrounds, borders & shadows

A systematic look at backgrounds (including gradients), borders, rounded corners (border-radius), shadows, rings (focus), outlines, and dividers (divide) with Tailwind CSS. It also covers implementations of UI parts such as cards / buttons / hero sections.

Color system

Tailwind CSS's color palette (26 colors × 11 steps as of v4.2) and how to use it. It covers text / background / border / ring / opacity (the /N notation backed by color-mix) / v4's oklch color space / CSS variable integration (bg-(--my-color)) through practical examples.

Component Patterns

Systematically implement reusable UI components (button / card / form / nav / alert / badge / tooltip / modal) with Tailwind CSS. It also organizes accessibility (ARIA attributes), so you learn production-quality patterns.

Container Queries

An explanation of container queries, which gained native support in Tailwind CSS v4. It organizes the `@container` declaration, the @3xs–@7xl container breakpoints, named containers, the arbitrary-value `@[500px]:` notation, and when to use them versus media queries, all through implementation examples.

Customization

Putting Tailwind CSS v4's CSS-First Configuration into practice. Define colors / fonts / spacing / breakpoints / shadows / animations in CSS with `@theme`, and implement theme extensions with `@utility` / `@custom-variant` / `@plugin` / `@layer`.

Dark Mode

Dark mode implementation with Tailwind CSS's `dark:` variant. It covers a comparison of the three approaches (media query / class-based / selector-based), FOUC mitigation, a recommended color mapping, and centralized theme color management with CSS variables, all through implementation examples.

Design Systems and Design Tokens

A chapter that explains where the color of bg-primary comes from. You learn the two layers of design tokens (primitive / semantic), OKLCH colors, token definitions with Tailwind v4's @theme inline, and how light / dark themes work.

Designing a Design System with the shadcn/ui Button

Targets React 19 / Tailwind CSS v4 / the latest shadcn/ui. A 13-chapter guide that uses the Button to teach reusable component design aligned with a design system through design tokens, cva, cn, and Radix Slot.

Flexbox layout

How to build Flexbox layouts with Tailwind CSS. From creating a flex container, it organizes flex-direction / flex-wrap / justify-content / align-items / gap / order in tables, then cements it with navigation bar / card / search form implementations.

Forwarding ref: The React 19 Way

In this chapter, you learn how to access DOM elements using ref. We focus on the new React 19 style where ref is a normal prop, and also cover the traditional forwardRef.

From Button to a Design System

The final chapter that brings the design-token, cva, cn, Slot, and type patterns learned with Button into a single design system made of three layers (design tokens / primitives / patterns). It also introduces points for team operation and the next steps.

Frontend

A hub for the domain that collects notes on frontend development, such as React, Tailwind CSS, and shadcn/ui. It covers UI construction, styling, and component design.

Grid Layout

How to leverage CSS Grid with Tailwind CSS. It systematically covers grid-cols / grid-rows, col-span / row-span, place-items, grid-auto-flow, and subgrid support, then cements it with dashboard / card gallery / image grid implementations.

Hands-On Practice: Building a Button Component from Scratch

A hands-on exercise that starts from a plain button and stacks Tailwind design tokens, cva, cn, asChild (Slot), and TypeScript types one step at a time to complete a shadcn/ui-style Button component from scratch. It includes bonus exercises for adding a success variant and a loading state.

How the cn function works: understanding clsx and tailwind-merge

A chapter that digs into the internal behavior of clsx and tailwind-merge, which make up the shadcn/ui cn function, along with actual results. You learn about excluding falsy values, conflict resolution via conflict groups, and why the order is clsx then twMerge.

Practical Project

A practical chapter that integrates the Tailwind CSS v4 knowledge you have learned to build a SaaS landing page. You implement all of the hero / features / pricing / FAQ / CTA / footer sections, and also set up custom animations with @theme + @keyframes.

Responsive Design

Responsive implementation with Tailwind CSS's mobile-first approach. It organizes the sm/md/lg/xl/2xl breakpoints, max-* variants, v4 custom breakpoints, and arbitrary-value bracket notation through nav / hero / footer implementation examples.

Setup

How to set up a Tailwind CSS v4 development environment in four ways — Vite / PostCSS / CLI / CDN. It covers supported-browser requirements, the VS Code extension (Tailwind CSS IntelliSense), class sorting with the Prettier plugin, and a guideline for production build size.

Sizing and positioning

Systematizes element sizing (width / height / min-* / max-* / size-*), positioning (static/relative/absolute/fixed/sticky), z-index, object-fit, overflow, and aspect-ratio with Tailwind CSS. It also organizes implementation examples such as the three centering patterns, a fixed header, and a modal.

Spacing

Tailwind CSS's 4px-based spacing system. It compares padding / margin / gap / space-* / logical properties (ps/pe), and organizes negative margins for full-bleed layouts and v4's arbitrary-value syntax through practical examples.

State Variants

Systematically covers Tailwind CSS state variants (hover / focus / focus-visible / focus-within / active / disabled / invalid / checked), groups (group-*), peers (peer-*), pseudo-classes (first/last/odd/even), pseudo-elements (before/after), and has-*.

Tailwind CSS (React integration patterns)

A chapter for using Tailwind CSS, which has become the de facto standard in React development, practically in React. Setup and basics are left to a separate guide; this chapter covers patterns specific to React integration, such as variant design, the clsx / tailwind-merge / cn utilities, and integration with shadcn/ui.

Tailwind CSS basics: utility-first

A chapter that teaches the utility-first idea of Tailwind CSS by breaking down the actual class list of the shadcn/ui Button. It explains layout, state modifiers (hover / focus-visible / disabled), the spacing scale, and an entry point into design tokens.

Tailwind CSS Guide

A systematic learning guide for Tailwind CSS v4 in 18 chapters. From the utility-first mindset to Flexbox/Grid, typography, colors, responsive design, dark mode, container queries, and animation. You build a landing page in a hands-on project and acquire modern CSS styling.

The goal of this book and what you will learn

The introductory chapter of a guide that teaches design system design using the shadcn/ui Button. It explains the book's goal, who it is for, the structure of all 13 chapters, and why the Button is the ideal subject for component design.

The utility-first mindset

An explanation of the utility-first philosophy at the core of Tailwind CSS, compared with traditional CSS. It systematically organizes the class naming convention, the 4px-based spacing scale, and ways to address HTML bloat (componentization / @apply / @reference).

TypeScript Integration: Type-Safe Components

In this chapter, you learn about the TypeScript types that power the shadcn/ui Button. We cover props definitions using React.ComponentProps, VariantProps, and intersection types, and why React 19 no longer needs forwardRef generics.

Typography

How to style text with Tailwind CSS. It organizes font size (text-xs to text-6xl) / weight / family / line height / letter spacing / decoration / truncation (truncate, line-clamp) and considerations for Japanese fonts through practical examples.

What is Tailwind CSS

The introductory chapter of this Tailwind CSS v4 guide. It covers the utility-first mindset, how it differs from traditional CSS frameworks, an overview of v4 features such as CSS-First Configuration / the Oxide engine / built-in container queries, and the structure of the whole guide.