--- id: JosiahSiegel/claude-plugin-marketplace/tailwindcss-fundamentals-v4 version: "9c802b58" license: MIT install: manual updated: 2026-06-18 --- # tailwindcss-fundamentals-v4 — Master Tailwind CSS v4's CSS-first configuration model, Rust-powered engine, and modern setup across Vite and PostCSS. This skill covers installation methods, @theme-based theming, custom utilities and variants, plugin loading, and the shift from JavaScript config to pure CSS. Includes v3-to-v4 migration guidance and reference for new v4 utilities. Publisher: JosiahSiegel · Stars: 49 · Updated: 2026-06-18 Install (manual): `git clone https://github.com/JosiahSiegel/claude-plugin-marketplace` ## SKILL.md # Tailwind CSS v4 Fundamentals (2025/2026) ## Overview Tailwind CSS v4.0 was released January 22, 2025, featuring a complete rewrite with a Rust-based engine, CSS-first configuration, and significant performance improvements. ### Key Changes from v3 | Feature | v3 | v4 | |---------|----|----| | Configuration | JavaScript (tailwind.config.js) | CSS-first (@theme directive) | | Engine | Node.js | Rust (10x faster) | | Color format | hex/rgb | OKLCH (perceptually uniform) | | Plugins | JS files | @plugin directive | | Custom utilities | JS config | @utility directive | | PostCSS imports | postcss-import | Built-in | | Autoprefixer | Required | Built-in | | CSS nesting | postcss-nested | Built-in | | Content detection | Explicit config | Automatic | ## Installation ### Vite Projects (Recommended) ```bash npm install -D tailwindcss @tailwindcss/vite ``` ```javascript // vite.config.js import tailwindcss from '@tailwindcss/vite' import { defineConfig } from 'vite' export default defineConfig({ plugins: [tailwindcss()] }) ``` ### PostCSS Projects ```bash npm install -D tailwindcss @tailwindcss/postcss ``` ```javascript // postcss.config.mjs export default { plugins: { '@tailwindcss/postcss': {} } } ``` ### CSS Entry Point ```css /* app.css - The only required CSS file */ @import "tailwindcss"; ``` ## CSS-First Configuration ### The @theme Directive Replace tailwind.config.js with CSS-based configuration: ```css @import "tailwindcss"; @theme { /* Colors using modern oklch */ --color-primary: oklch(0.6 0.2 250); --color-secondary: oklch(0.7 0.15 180); --color-accent: oklch(0.8 0.2 30); /* Typography */ --font-display: "Satoshi", sans-serif; --font-body: "Inter", sans-serif; /* Custom spacing */ --spacing-xs: 0.25rem; --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 2rem; --spacing-xl: 4rem; /* Custom breakpoints */ --breakpoint-xs: 475px; --breakpoint-3xl: 1920px; } ``` ### Theme Variables Reference | Category | Variable Pattern | Example | |----------|-----------------|---------| | Colors | `--color-*` | `--color-brand-500` | | Fonts | `--font-*` | `--font-heading` | | Spacing | `--spacing-*` | `--spacing-4` | | Breakpoints | `--breakpoint-*` | `--breakpoint-3xl` | | Radius | `--radius-*` | `--radius-lg` | | Shadows | `--shadow-*` | `--shadow-xl` | | Animations | `--animate-*` | `--animate-fade-in` | | Easing | `--ease-*` | `--ease-bounce` | ### Disabling Defaults ```css @theme { /* Start fresh - disable all default theme values */ --*: initial; /* Define only what you need */ --spacing: 4px; --font-body: Inter, sans-serif; --color-primary: oklch(0.72 0.11 221.19); --color-secondary: oklch(0.74 0.17 40.24); } ``` ## Custom Utilities ### Static Utilities ```css /* Define custom utility in CSS */ @utility content-auto { content-visibility: auto; } @utility text-balance { text-wrap: balance; } @utility scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; } @utility scrollbar-hide::-webkit-scrollbar { display: none; } ``` Usage: ```html

Long headline that should balance nicely

``` ### Functional Utilities ```css /* Utility that accepts values */ @utility tab-* { tab-size: --value(integer); } @utility text-shadow-* { text-shadow: 0 0 --value([length]) currentColor; } /* With theme reference */ @utility gap-safe-* { gap: max(--value(--spacing-*), env(safe-area-inset-bottom)); } ``` Usage: ```html
Code with 4-space tabs

Glowing text

Safe area aware gap
``` ## Custom Variants ### The @custom-variant Directive ```css /* Dark mode with selector */ @custom-variant dark (&:where(.dark, .dark *)); /* Custom state variants */ @custom-variant hocus (&:hover, &:focus); @custom-variant group-hocus (:merge(.group):hover &, :merge(.group):focus &); /* Data attribute variants */ @custom-variant data-loading (&[data-loading="true"]); @custom-variant data-active (&[data-state="active"]); /* Child selectors */ @custom-variant children (& > *); @custom-variant not-first (& > *:not(:first-child)); ``` Usage: ```html
Loading...
``` ## Loading Plugins ### The @plugin Directive ```css @import "tailwindcss"; /* Load official plugins */ @plugin "@tailwindcss/typography"; @plugin "@tailwindcss/forms"; @plugin "@tailwindcss/container-queries"; /* Load local plugin */ @plugin "./my-plugin.js"; ``` ### Plugin with Options ```css @plugin "@tailwindcss/typography" { className: wysiwyg; } @plugin "@tailwindcss/forms" { strategy: class; } ``` ## Using Prefixes ```css @import "tailwindcss" prefix(tw); @theme { /* Define without prefix */ --font-display: "Satoshi", sans-serif; } ``` ```html
Content
``` Generated CSS variables include prefix: ```css :root { --tw-font-display: "Satoshi", sans-serif; } ``` ## CSS Variables in Code ### Replace theme() with var() ```css /* v3 approach (deprecated) */ .old-way { background-color: theme(colors.red.500); } /* v4 approach */ .new-way { background-color: var(--color-red-500); } /* In media queries, use CSS variable names */ @media (width >= theme(--breakpoint-xl)) { /* styles */ } ``` ## Core Utility Categories ### Layout ```html
``` ### Spacing ```html
``` ### Typography ```html

``` ### Colors ```html

``` ## Common Migration Issues ### Border Color Default ```css /* v3: border used gray-200 by default */ /* v4: border uses currentColor */ /* Fix: explicitly set color */ @theme { --default-border-color: var(--color-gray-200); } ``` ### Ring Default ```css /* v3: ring was 3px blue-500 */ /* v4: ring is 1px currentColor */ /* Fix: restore v3 behavior */ @theme { --default-ring-width: 3px; --default-ring-color: var(--color-blue-500); } ``` ### Button Cursor ```css /* v4: buttons use cursor: default */ /* Fix: add pointer globally if needed */ button { cursor: pointer; } ``` [View on SkillFed](https://skillfed.io/JosiahSiegel/claude-plugin-marketplace/tailwindcss-fundamentals-v4) · [View on GitHub](https://github.com/JosiahSiegel/claude-plugin-marketplace)