askill
tailwindcss-v4

tailwindcss-v4Safety 100Repository

Tailwind CSS v4.1 core features, @theme, directives, migration guide

0 stars
1.2k downloads
Updated 2/5/2026

Package Files

Loading files...
SKILL.md

Tailwind CSS v4.1 Core

Documentation

Quick Reference - @theme Namespaces

NamespaceGenerated Utilities
--color-*bg-, text-, border-, fill-
--font-*font-*
--text-*text-xs, text-sm, text-base, etc.
--spacing-*p-, m-, gap-, w-, h-*
--radius-*rounded-*
--shadow-*shadow-*
--breakpoint-*sm:, md:, lg:, xl:
--animate-*animate-spin, animate-bounce, etc.
--ease-*ease-in, ease-out, ease-in-out

Configuration CSS-first

Before (v3)

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: { brand: '#3B82F6' }
    }
  }
}

After (v4)

@import "tailwindcss";

@theme {
  --color-brand: #3B82F6;
}

Directives v4

@utility - Create a utility

@utility tab-4 {
  tab-size: 4;
}
/* Usage: class="tab-4" */

@variant - Conditional style

.card {
  @variant dark {
    background: #1a1a2e;
  }
}

@custom-variant - New variant

@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
/* Usage: dark:bg-gray-900 */

v3 → v4 Breaking Changes

Removed @tailwind directives

/* v3 */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* v4 */
@import "tailwindcss";

Renamed utilities

v3v4
shadow-smshadow-xs
shadowshadow-sm
rounded-smrounded-xs
roundedrounded-sm
outline-noneoutline-hidden
ringring-3

Removed deprecated utilities

  • bg-opacity-* → use bg-black/50
  • text-opacity-* → use text-black/50
  • flex-shrink-* → use shrink-*
  • flex-grow-* → use grow-*

Custom utilities syntax

/* v3 */
@layer utilities {
  .tab-4 {
    tab-size: 4;
  }
}

/* v4 */
@utility tab-4 {
  tab-size: 4;
}

Variables in arbitrary values

<!-- v3 -->
<div class="bg-[--brand-color]"></div>

<!-- v4 -->
<div class="bg-(--brand-color)"></div>

Important modifier position

<!-- v3 -->
<div class="!bg-red-500">

<!-- v4 -->
<div class="bg-red-500!">

Upgrade Tool

npx @tailwindcss/upgrade

Requires Node.js 20+

Browser Support

  • Safari 16.4+
  • Chrome 111+
  • Firefox 128+

Installation

npm install -D tailwindcss @tailwindcss/postcss
# or for Vite
npm install -D @tailwindcss/vite
# or for CLI
npm install -D @tailwindcss/cli

Core API Functions

--alpha()

Adjust color opacity:

color: --alpha(var(--color-lime-300) / 50%);

--spacing()

Generate spacing values:

margin: --spacing(4);

@apply

Inline utility classes:

.btn {
  @apply px-4 py-2 rounded-lg font-bold;
}

Key Resources

  • Official Theme Variables Documentation
  • @theme Directive Syntax
  • Content Detection Configuration
  • Custom Variant Creation
  • Animation Keyframes Definition
  • CSS Variables Usage

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

95/100Analyzed 2/13/2026

A high-quality, high-density technical reference for Tailwind CSS v4.1. It provides excellent 'before vs after' comparisons for migration, clear configuration examples, and actionable CLI commands. The structure is highly readable with tables and code blocks.

100
95
100
90
95

Metadata

Licenseunknown
Version-
Updated2/5/2026
Publishermajiayu000

Tags

api