Custom text size not being overridden by standard text utilities
What version of Tailwind CSS are you using?
4.1.11
What build tool (or framework if it abstracts the build tool) are you using?
Vite 7.1.7
What version of Node.js are you using?
bun 1.2.22
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction URL
https://github.com/ali-issa/tailwind-text-utilities-bug
Describe your issue
When creating a custom text size utility using CSS theme variables as documented in the Tailwind CSS v4 documentation, the custom size cannot be overridden by standard text utilities when using tailwind-merge with clsx.
Steps to reproduce:
- Define a custom text size in CSS:
@theme {
--text-tiny: 0.625rem;
}
- Create a component that uses the custom text size:
function MyComponent({ className }: { className?: string }) {
return (
<div className={cn("text-tiny", className)}>
Sample text content
</div>
);
}
- Try to override the text size when using the component:
<MyComponent className="text-xl" />
Expected behavior:
The text-xl class should override the text-tiny class, resulting in the text being displayed at the xl size.
Actual behavior:
The custom text-tiny class takes precedence and the text remains at the tiny size (0.625rem), ignoring the text-xl override and all other text-* classes.
Additional context:
- tailwind-merge version: ^3.3.1
- clsx version: ^2.1.1