Tailwind CSS v4 is here and it's time to upgrade tailwind-merge to support it. tailwind-merge v3.0.0 is more accurate than ever and follows the Tailwind CSS spec more closely than in v2. That is thanks to Tailwind CSS v4 being more consistent than ever.
This release drops support for Tailwind CSS v3 and in turn adds support for Tailwind CSS v4. That means you should upgrade to Tailwind CSS v4 and tailwind-merge v3 together. All breaking changes are related to the Tailwind CSS v4 support.
Check out the migration guide and if you have any questions, feel free to create an issue.
Breaking Changes
- Dropping support for Tailwind CSS v3 in favor of support for Tailwind CSS v4 by @dcastil in #518
- Theme scales keys changed and now match Tailwind CSS v4 theme variable namespace exactly by @dcastil in #518
isLength
validator was removed and split into separate validatorsisNumber
andisFraction
by @dcastil in #518- Prefix defined in config shouldn't include combining
-
character anymore by @dcastil in #518 - Tailwind CSS v3 prefix position in class not supported anymore in favor of Tailwind CSS v4 position by @dcastil in #518
- Custom separators are no longer supported by @dcastil in #518
- New mandatory
orderSensitiveModifiers
property in config when usingcreateTailwindMerge
by @dcastil in #518 DefaultThemeGroupIds
type union consists of different string literals than before by @dcastil in #518- Classes removed in Tailwind CSS v4 are not supported by tailwind-merge anymore by @dcastil in #518
New Features
- Support for new important modifier position at the end of class by @dcastil in #518
- Support for arbitrary CSS variable syntax by @dcastil in #518
- There are a bunch of new validators used by tailwind-merge, primarily for new Tailwind CSS v4 features like arbitrary CSS variables by @dcastil in #518
Bug Fixes
- Previously some order-sensitive modifiers like
before:
were treated as not order-sensitive. This is now fixed by @dcastil in #518
Documentation
- Added section explaining order-sensitive modifiers to configuration docs by @dcastil in #518
Full Changelog: v2.6.0...v3.0.0
Thanks to @brandonmcconnell, @manavm1990, @langy, @jamesreaco, @roboflow, @syntaxfm, @getsentry, @codecov and a private sponsor for sponsoring tailwind-merge! ❤️