npm / tailwindcss
tailwindcss
What changed in tailwindcss 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
50 breaking3 deprecations53 new APIs and options7 performance39 behavior and defaults13 tooling147 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli inittailwindcss 4311 changes
Breaking changes 50
Nested rules that put a combinator after a pseudo-element are dropped.
Root namespace lookups in JavaScript plugins and config files return the full namespace object instead of its
DEFAULTvalue.Selectors combining an attribute selector and element selector without spacing are parsed as two selectors.
This syntax now generates font-size declarations instead of color declarations.
Requires --value(…) in functional @utility definitions.
Logical end utilities are canonicalized into corresponding
inset-e-*utilities, including negative versions.Logical start utilities are canonicalized into corresponding
inset-s-*utilities, including negative versions.Placeholder utilities now read their color from
--placeholder-color.The deprecated
overflow-ellipsisutility is canonicalized intotext-ellipsis.Commas are no longer converted to spaces in arbitrary grid and object-position values; use underscores to represent spaces.
The v3 backdrop-blur-sm utility is now backdrop-blur-xs; backdrop-blur-sm now corresponds to the former bare utility.
Linear gradient utilities support angle values, and the bg-gradient-* naming has been changed to bg-linear-*.
The v3 blur-sm utility is now blur-xs; blur-sm now corresponds to the former bare blur utility.
Border utilities now use currentColor by default instead of the configured gray-200 color.
Tailwind CSS v4 targets Safari 16.4+, Chrome 111+, and Firefox 128+, and will not work in older browsers.
Buttons now use cursor: default instead of cursor: pointer.
JavaScript config files are no longer detected automatically; load one explicitly with the @config directive.
The container utility no longer has configuration options such as center and padding; customize it with @utility.
The corePlugins option for completely disabling framework utilities is no longer supported.
Use parentheses rather than square brackets for CSS variables in arbitrary values.
The default palette uses oklch instead of rgb, with more vivid colors that take advantage of wider-gamut displays.
Utilities deprecated in v3 and undocumented for several years have been removed, including opacity, flex sizing, ellipsis, and decoration utilities.
Preflight now resets margins on dialog elements; add margin: auto to keep dialogs centered by default.
Divide utilities now use currentColor by default instead of the configured gray-200 color.
The divide selector changed to target all but the last child and apply border-bottom-width, which may affect inline elements and child spacing or borders.
The v3 drop-shadow-sm utility is now drop-shadow-xs; drop-shadow-sm now corresponds to the former bare drop-shadow utility.
Gradient values set by other utilities are preserved when a variant overrides part of a gradient; use via-none to unset a three-stop gradient.
Display classes no longer override the hidden attribute, except when hidden is set to until-found.
The hover variant applies only when the primary input device supports hover.
Import Tailwind with a regular CSS @import statement instead of the v3 @tailwind directives.
The outline utility now sets outline-width: 1px by default.
outline-none now actually sets outline-style: none; the former invisible-outline behavior is named outline-hidden.
Placeholder text now uses the current text color at 50% opacity instead of the configured gray-400 color.
Prefixes now behave like variants and appear at the beginning of class names; generated CSS variables also include the prefix.
The exported resolveConfig function has been removed; use generated CSS variables directly instead.
The ring utility now adds a 1px ring instead of 3px and uses currentColor instead of blue-500 by default.
The v3 rounded-sm utility is now rounded-xs; rounded-sm now corresponds to the former bare rounded utility.
The JavaScript config safelist option is unsupported; use @source inline() to safelist utilities.
Tailwind CSS v4 is not designed to work with Sass, Less, or Stylus; these preprocessors cannot be used for stylesheets or component style blocks.
Scale utilities now use the individual CSS scale property; reset with scale-none rather than transform-none.
The JavaScript config separator option is no longer supported in v4.
The v3 shadow-sm utility is now shadow-xs; shadow-sm now corresponds to the former bare shadow utility.
The spacing selector changed to target all but the last child and apply margin-bottom, which may affect inline elements and custom child margins.
The v3 @tailwind directives are removed; use a regular CSS @import statement.
Tailwind CLI now lives in a dedicated package, so build commands should use this package.
The PostCSS plugin now lives in a dedicated package instead of the tailwindcss package.
The upgrade tool automates much of the v3-to-v4 migration, including dependency updates, configuration migration, and template changes; it requires Node.js 20 or higher.
transform-none no longer resets rotate, scale, and translate utilities; reset the individual properties instead.
Use the @utility API to register custom utilities; they support variants and are sorted by the number of properties they define.
Stacked variants now apply left to right instead of right to left; reverse order-sensitive variant stacks when upgrading.
Deprecations 3
The end-* utilities are deprecated in favor of inset-e-* utilities.
The start-* utilities are deprecated in favor of inset-s-* utilities.
Place ! at the end of a utility class name; the former leading-! syntax remains supported for compatibility but is deprecated.
New APIs and options 53
The CLI supports polling watch mode when filesystem events are unreliable or unavailable.
Adds an option to suppress CLI output.
Adds the @container-size utility.
Adds scrollbar-width utilities for auto, thin, and none values.
Adds scrollbar-gutter utilities.
Adds tab utilities.
Supports --default(…) inside --value(…) and --modifier(…) for functional utility definitions.
Adds zoom utilities.
The standalone CLI now supports the
NODE_PATHenvironment variable.Adds utilities for block-size.
Adds utilities for border-block-end.
Adds utilities for border-block-start.
The default theme now includes mauve, olive, mist, and taupe color palettes.
Adds a utility for font-feature-settings.
Adds utilities for inline-size.
Adds utilities for inset-block-end.
Adds utilities for inset-block-start.
Adds utilities for inset-inline-end.
Adds utilities for inset-inline-start.
Adds utilities for max-block-size.
Adds utilities for max-inline-size.
Adds utilities for margin-block-end.
Adds utilities for margin-block-start.
Adds utilities for min-block-size.
Adds utilities for min-inline-size.
Adds utilities for padding-block-end.
Adds utilities for padding-block-start.
Adds utilities for scroll-margin-block-end.
Adds utilities for scroll-margin-block-start.
Adds utilities for scroll-padding-block-end.
Adds utilities for scroll-padding-block-start.
New utilities including rotate-x-*, rotate-y-*, scale-z-*, and translate-z-* enable 3D transforms in HTML.
New utilities create conic gradients and work with existing from-*, via-*, and to-* utilities.
New utilities create radial gradients and work with existing from-*, via-*, and to-* utilities.
New color-scheme utilities let developers control scrollbars in dark mode.
Container query support is built into core, so the container-queries plugin is no longer needed.
Configure design tokens, custom utilities, and variants directly in CSS instead of configuring the project in JavaScript.
A new variant styles all descendant elements.
New field-sizing utilities support auto-resizing textareas without JavaScript.
New font-stretch utilities support adjustments to variable fonts that offer different widths.
Gradient utilities accept modifiers such as /srgb and /oklch to choose the color interpolation mode; OKLAB is the default.
The new in-* variant is similar to group-* but does not require the group class.
The new inert variant styles non-interactive elements marked with the inert attribute.
New inset ring utilities allow up to four layers of box shadows on one element.
New inset shadow utilities allow up to four layers of box shadows on one element.
The new @max-* variant supports max-width container queries and can be stacked with @min-* to define ranges.
The new variant negates selectors, media queries, and @supports queries.
New nth-* variants support styling elements by their position.
Use @reference to make theme variables, custom utilities, and custom variants available in separately bundled stylesheets without duplicating CSS.
Use the @source directive in CSS to explicitly add a source excluded by default content detection.
The starting variant supports CSS @starting-style, allowing element properties to transition when an element is first displayed.
The @theme CSS directive defines design tokens and other framework customizations.
The transition utility now includes the outline-color property.
Performance 7
Canonicalization is faster in projects with many functional variant values, such as a matchVariant plugin with thousands of values.
collapse: trueno longer takes exponentially longer when classes are linked through a utility that sets many properties.Style invalidation performance is improved for
group-*andpeer-*variants.Ignored directories are skipped when generating watch globs instead of having their contents walked on every rebuild.
Scanning JSONL and NDJSON files is faster.
The Oxide scanner performs fewer file system walks in bigger projects.
The rewritten engine makes full builds faster and incremental builds with no new CSS over 100x faster, completing in microseconds.
Behavior and default changes 39
Bare spacing values now work with auto-cols utilities.
Bare spacing values now work with auto-rows utilities.
Can now be used with CSS mixins.
One-valued spacing utilities generate var(--spacing) instead of calc(var(--spacing) * 1).
Can now be used inside addBase.
Adds parentheses when whitespace removal would hurt readability.
Preserves the original unit in arbitrary values instead of converting to base units.
Canonicalizes arbitrary :has() variants to the has-[…] form.
Allows multiple utility definitions with the same name when their value types differ.
Allows @variant to use stacked variants such as hover:focus.
Allows @variant to use compound variants such as hover and focus.
Border side utility combinations are canonicalized into axis or all-side utilities.
.envand.env.*are now excluded from default content-file scanning.The upgrade process no longer migrates files ignored by git.
Axis-specific overflow utilities are canonicalized into the combined overflow utility.
Axis-specific overscroll utilities are canonicalized into the combined overscroll utility.
Equivalent arbitrary padding utilities are canonicalized into shorthand utilities.
Scroll margin side combinations are canonicalized into axis or all-side utilities.
Scroll padding side combinations are canonicalized into axis or all-side utilities.
Canonicalization now prefers non-negative tracking utilities.
Canonicalizes calc(var(--spacing)*…) expressions into the --spacing(…) form.
Aspect-ratio fractions may now use multiples of .25, such as aspect-8.5/11.
The .jj directory is now ignored by default during content detection.
Utility names may now contain escape characters, improving formatter support.
Arbitrary utilities are now canonicalized to bare values when possible.
Candidate validation now behaves more like Oxide.
Canonicalization now combines text-* and leading-* classes.
Upgrade processing canonicalizes utilities containing 0 values.
Template files are detected automatically, so projects no longer need to configure paths in a content array.
Vendor prefixing is handled automatically in v4, so this plugin can be removed from projects.
Boolean data attributes can be targeted with variants without defining them in configuration.
Many utilities accept values derived dynamically from the spacing scale, without configuration or arbitrary-value syntax.
The existing open variant also targets elements with the :popover-open pseudo-class.
All outline-<number> utilities now default outline-style to solid, so they no longer need to be combined with outline.
Imports are handled automatically in v4, so this plugin can be removed from projects.
Rotate utilities now use the individual CSS rotate property rather than the transform property.
Theme values are available as CSS variables and are recommended instead of theme(); where theme() is needed, use CSS variable names rather than dot notation.
The transition-colors utility now includes the outline-color property.
Translate utilities now use the individual CSS translate property rather than the transform property.
Tooling 13
Adds a Turbopack loader for using Tailwind CSS with Next.js.
Named opacity modifiers now receive class suggestions from --opacity theme values.
Class candidates adjacent to Template Toolkit delimiters are now extracted from .tt, .tt2, and .tx files.
Class candidates are now extracted from Twig addClass calls.
Can be installed in Rspack projects without webpack as a peer dependency.
The v3-to-v4 migration now uses
config.content.Adds support for Vite 8 in the Tailwind CSS Vite integration.
The CLI emits a comment when source maps are saved to files.
A new package runs Tailwind CSS as a webpack plugin.
CSS parse errors now include the filename and line numbers, making failures easier to locate.
The environment API is now supported in the Vite integration.
The deprecated break-words utility is migrated to wrap-break-word during upgrades.
A dedicated Vite plugin is available and recommended over the PostCSS plugin for improved performance and developer experience.
Fixes and other changes 146
Tailwind no longer crashes or creates a fallback with the wrong color for color-mix() values without a color interpolation method.
Comments between top-level CSS rules are ignored instead of causing an error or swallowing the next rule.
Type declarations no longer cause type errors with skipLibCheck: false due to imports of unshipped modules.
The WASI package loads instead of hanging forever, including when NAPI_RS_FORCE_WASI=error or in WebContainers.
The WASI package detects changed and new source files after its first scan, including in WebContainers.
CSS is not generated for candidates containing an empty additional modifier.
Viewport and font-relative units are treated as lengths in arbitrary values.
CSS is not generated for arbitrary values with unbalanced parentheses or brackets.
Automatic source detection respects negation-based
.gitignorefiles.Cached compilers release their
loadModuleandloadStylesheetcallbacks after compilation.Utilities are not collapsed into a utility using another theme variable with the same default value.
A utility setting a
--tw-*variable is not dropped when an unrelated property has the same value.Arbitrary breakpoint and container query variants are converted to named equivalents when canonicalized.
Utilities referencing different theme variables set to CSS-wide keywords like
unsetare not merged.Canonicalization preserves
&when moving a pseudo-element into*or**.Inline
theme(…)alphas with more than two decimals migrate to a percentage modifier with the same opacity.Inline
theme(…)alphas remain arbitrary percentages when a custom--opacity-*theme value would change their opacity.When collapsing utilities, an existing candidate is preferred over another utility with the same default theme value.
The
Set.prototype.intersectionpolyfill returns the intersection instead of the first set on Node.js versions below 22.Invalid UTF-8 candidates are dropped during class detection.
Comments ending with
\*/are closed correctly instead of swallowing following CSS.A declaration without a trailing semicolon is kept at the end of the CSS input.
A custom property at the end of the input is parsed when it has no trailing semicolon.
&is substituted inside:-moz-any(…)and:-webkit-any(…)in custom variants.Whitespace in
--default(…)values is preserved in functional@utilitydefinitions.!importantinside strings, comments, orurl()in declaration values is no longer treated as the important flag.CSS optimization no longer warns about Angular's
::ng-deepand:host-context().The fallback is no longer applied in Safari versions that no longer support
margin-trim: inline.Class shorthands on later lines are extracted when preceding Pug text, comments, or quoted attributes contain unbalanced brackets or a quote that doesn't start a string.
Class candidates are extracted from Ruby
%wand%Wliterals using angle brackets or custom delimiters, including in Slim and Haml templates.Variants using
@scopewrap generated utilities instead of nesting inside them.Nested
@scoperules preserve their scoping semantics when flattened.Declarations directly inside
@scopeare preserved by wrapping them in:where(:scope).Watch mode now detects changes to symlinked source files whose real paths aren't otherwise scanned.
Standalone macOS binaries have a valid code signature so macOS 27 no longer kills them at launch.
and,or, andnotinside selectors are preserved insupports-[…]variants.Plugin logs are written to stderr so they do not appear in results on stdout.
Oxide falls back to WASM on platforms without native bindings.
Relative stylesheet URLs are rewritten in optimized builds even when the stylesheets were inlined before the plugin runs.
Turbopack rebuilds when the input CSS changes.
The Vite plugin no longer crashes on every edit under experimental
bundledDevmode.Webpack rebuilds when the input CSS changes.
Single-digit hexadecimal escapes in theme variable and
@utilitynames are decoded according to the CSS spec.Utilities are not generated when a modifier would otherwise be silently ignored.
Warnings underline the correct occurrence of an unsupported data type.
Generated utilities include a space in empty
var()fallbacks.min-*,max-*, and container query variants with decimal values are sorted numerically.Achromatic theme colors no longer shift hue when mixed in polar color spaces such as oklch.
Arbitrary hex colors now match theme colors case-insensitively during canonicalization.
CSS nesting is handled even when Lightning CSS is not run, including browser builds and Tailwind Play.
Fractional opacity modifiers now work with named shadow, text-shadow, drop-shadow, and inset-shadow sizes.
Preflight no longer overrides Firefox's native focus-visible outline styles for iframes.
The watcher dependency loads only for CLI watch mode, allowing one-off builds and polling when it cannot be loaded.
Explicit platform fonts replace generic system fonts so CJK text respects the page's lang attribute on Windows.
Earlier @source rules for nested files are scanned even when later rules reference parent folders.
--spacing(0)now optimizes to0px, preserving its length type inside calc expressions.PostCSS rebuilds when a preprocessor changes input CSS without changing the input file on disk.
The upgrade command no longer rewrites ignored files when run from a subdirectory.
Vite integration no longer triggers full page reloads for scanned files not yet loaded as modules.
JS plugins now resolve theme colors correctly when similarly prefixed color variables coexist.
Class candidates are now extracted from conditional Maud syntax.
Position try rules no longer trigger unknown at-rule warnings during CSS optimization.
Source patterns no longer scan unrelated sibling files and folders.
Watch mode no longer crashes on Windows when @source points to a missing directory.
Watch mode now rebuilds when the input CSS file changes in an ignored directory.
Prevents type errors when used with newer PostCSS patch releases.
Avoids HMR crashes when scanned files or directories are deleted.
Avoids crashes in Deno v2.8.x when context.parentURL is not a valid URL.
Variants used in addBase can now reference custom variants defined later.
Canonicalization avoids suggesting large spacing-scale values for arbitrary lengths.
Canonicalization no longer suggests invalid calc expressions.
Canonicalization no longer folds divisions when the result would require high precision.
Color utilities now work with custom shadow values containing calc expressions.
Upgrade no longer migrates empty class rules to invalid @utility rules.
Transitions between inset-shadow-none and other inset shadows now work correctly.
Removes deprecation warnings on Node 26 and newer.
Correctly negates @container queries, including style queries.
Canonicalization no longer crashes when plugin utilities throw for unsupported values.
Class candidates are now extracted from Twig removeClass calls.
No longer crashes when scanning files containing invalid UTF-8 bytes.
Source globs with symlinks are preserved.
Later source rules can re-include files excluded by earlier source-not rules.
Explicitly referenced source directories are scanned even when ignored by git.
Source globs ending in **/* preserve dynamic path segments and avoid scanning too many files.
Zero-valued spacing utilities generate 0 instead of calc(var(--spacing) * 0).
Standalone CLI binaries are ignored when scanning for class candidates.
Watch mode recovers when a tracked dependency is deleted and restored.
Serves ESM type declarations to ESM importers.
Fixes incorrect sourcemap warnings when using the Vite integration.
No longer crashes when scanning files containing invalid UTF-8 bytes.
Preserves significant underscore whitespace during canonicalization.
Prevents legacy end utilities without values from generating CSS.
Resolves relative @import paths from the correct directory with @tailwindcss/vite.
Prevents the upgrade process from migrating inline style attributes.
Preserves required whitespace around operators in negated arbitrary values.
Resolves package JavaScript entries instead of browser CSS entries with @tailwindcss/vite.
Resolves relative @plugin paths from the correct directory with @tailwindcss/vite.
Exports the missing PluginWithConfig type from tailwindcss/plugin for plugin config type inference.
Prevents legacy start utilities without values from generating CSS.
Resolves imports relative to base when result.opts.from is not provided.
Ensures CSS files containing @variant are processed by @tailwindcss/vite.
Imports in @import and @plugin now resolve correctly when using Vite aliases in @tailwindcss/vite.
Invalid characters exceeding the valid Unicode code point range no longer cause a crash.
Negative arbitrary values move the minus sign inside the arbitrary value.
Negative arbitrary margin values move the minus sign outside the arbitrary value.
Stopping the upgrade process no longer empties files while the process is running.
Imports with query parameters are now treated as unique resources.
Prevents crashes when candidates contain prototype properties such as row-constructor.
Prevents crashes when canonicalizing utilities containing @property at-rules.
Improves canonicalization for bare values exceeding default spacing scale suggestions.
Prevents canonicalization from returning an empty list instead of the expected utility.
Skips full reloads for server-only modules scanned by client CSS with @tailwindcss/vite.
Trailing dashes in functional utility names are allowed for backwards compatibility.
Classes containing periods within curly braces in MDX files are now detected correctly.
Astro v5 import aliases now work without crashing with the Vite integration.
Utility detection now handles names containing capital letters followed by numbers.
Prevents color-mix values from receiving a double @supports wrapper.
Class extraction now works correctly for Rails strict locals.
The @source inline() argument may now contain surrounding whitespace.
Changes to external files listed via @source now trigger a full page reload with the Vite integration.
Utility name validation now matches Oxide scanner rules.
Using @variant inside @custom-variant no longer causes an infinite loop.
Arbitrary property utilities with a top-level ! in the value are now skipped correctly.
The CLI now handles duplicate command-line arguments correctly.
Color-mix fallback rules are no longer emitted inside keyframes.
Backwards compatibility for the content theme key in JavaScript configs is improved.
The CLI no longer hangs when its output is /dev/stdout.
The upgrade process now handles future and experimental configuration keys.
JavaScript configs now handle special defaults such as ringColor.DEFAULT correctly.
Comments in Ruby files are skipped when checking for class names.
Validation of source(…) now happens relative to the file containing it.
Theme keys from JavaScript configs and plugins now preserve their original case.
The CLI now writes source maps correctly when running in watch mode.
Legacy JavaScript APIs now substitute @variant correctly.
Prevents an occasional crash on Windows when Tailwind CSS is loaded into a worker thread.
Canonicalization of arbitrary variants with attribute selectors is fixed.
Canonicalization is improved for & > :pseudo and & :pseudo arbitrary variants.
Candidates with an empty data type are discarded.
Invalid colors caused by nested & are fixed.
At-rules parse correctly when they contain a tab character.
Safari devtools rendering is fixed when Tailwind uses color-mix fallbacks.
Lightning CSS warnings for :deep, :slotted, and :global are suppressed.
Important utilities no longer affect other utilities.
Named groups now work with not-*, has-*, and in-* variants.
The theme(…) function no longer indexes into strings.
Theme keys are resolved correctly when one key name starts with another in JS configs and plugins.
tailwindcss 31 changes
Fixes and other changes 1
Fixed sibling-*() functions used inside calc(…) so they no longer break.