-
-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Describe the bug
In Tailwind CSS v4, the translate-* utilities no longer require the transform base class, because they use the native translate property directly (e.g., translate: 50% 0). However, tailwind-merge still assumes that translate-* depends on transform, which leads to unexpected class merging behavior.
Classes like translate-x-1/2 are either dropped or not properly merged unless an unnecessary transform class is added manually, even though it has no effect in v4.
To Reproduce
Use tailwind-merge with the following:
twMerge("translate-x-1/2")
// Expected: "translate-x-1/2"
// Actual: gets dropped or ignored unless "transform" is addedBut in Tailwind CSS v4, this class works perfectly fine on its own, because:
.translate-x-1\/2 {
translate: 50% 0;
}Expected behavior
tailwind-merge should not require the transform class for translate-* utilities in Tailwind CSS v4. It should treat them as standalone, valid utilities.
Expected output:
twMerge("translate-x-1/2")
// => "translate-x-1/2" ✅No need for:
twMerge("transform translate-x-1/2")
// This is redundant in Tailwind v4Environment
- tailwind-merge version: [3.3.1]
- tailwindcss version: [4.1]
- package manager: [yarn]
- framework: [next.js, typescript]
Additional context
This is due to a major change in Tailwind CSS v4, where transform-related utilities (translate, rotate, scale, skew) use native properties like translate, rotate, and scale, and no longer depend on the transform class.
It would be ideal if tailwind-merge could support this change, perhaps by version awareness or by updating the merge logic for transform-related utilities.