Loading editor...
Loading editor...
Tailwind v4 Upgrade Guide
CSS Imports
Replace @tailwind directives with @import "tailwindcss";
Renamed Utilities
shadow-sm→shadow-xsshadow→shadow-smdrop-shadow-sm→drop-shadow-xsdrop-shadow→drop-shadow-smblur-sm→blur-xsblur→blur-smbackdrop-blur-sm→backdrop-blur-xsbackdrop-blur→backdrop-blur-smrounded-sm→rounded-xsrounded→rounded-smoutline-none→outline-hiddenring→ring-3
Removed Deprecated Utilities
bg-opacity-*→bg-black/50text-opacity-*→text-black/50border-opacity-*→border-black/50divide-opacity-*→divide-black/50ring-opacity-*→ring-black/50placeholder-opacity-*→placeholder-black/50flex-shrink-*→shrink-*flex-grow-*→grow-*overflow-ellipsis→text-ellipsisdecoration-slice→box-decoration-slicedecoration-clone→box-decoration-clone
Default Colors & Widths
- Border color:
gray-200→currentColor(specify colors explicitly) - Ring width: 3px → 1px (use
ring-3for previous behavior) - Ring color:
blue-500→currentColor(specify colors explicitly)
Variant Stacking Order
v3: right-to-left (first:*:pt-0) → v4: left-to-right (*:first:pt-0)
Space Between Utilities
The selector used by space-x-* and space-y-* has changed. Consider using flex/grid with gap-* instead.
CSS Variables in Arbitrary Values
bg-[--brand-color] → bg-(--brand-color)
Utility Prefixes
In v4, prefixes look like variants: tw-flex → tw:flex
Custom Utilities & Layers
Replace @layer utilities with @utility (requires manual edit)
Manual Updates
Some changes require manual CSS updates that can't be automated:
- Container Customization: Use
@utility container { ... }instead of container config options - Preflight Changes: Update placeholder colors, button cursors, dialog margins if needed
- Custom Layer Definitions: Update
@layer utilitiesto@utility - JavaScript Config Files: Use
@config "tailwind.config.js"to load them explicitly - Theme Values in JavaScript: Use CSS variables instead of resolveConfig