You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using tailwind-merge, any leading- utility classes (e.g., leading-6) are being stripped out from the final output, while other Tailwind utilities work correctly.
Steps to reproduce:
Using tailwind-merge in a utility function:
import { clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
Not 100% sure without the exact classes you're passing to tailwind-merge, but I suspect the reason why the line-height classes like leading-6 get removed is because you have a font-size class like text-lg afterwards which sets a line-height CSS property, overriding preceding line-height classes. If you want to change this overriding behavior and don't use line-heights in your font-size classes, you can override the conflict between the font-size and line-height classes:
import{extendTailwindMerge}from'tailwind-merge'consttwMerge=extendTailwindMerge({override: {conflictingClassGroups: {// In the default config the value is ['leading']// See https://github.com/dcastil/tailwind-merge/blob/v2.5.5/src/lib/default-config.ts#L1786'font-size': []}},// … rest of your config})
When using tailwind-merge, any leading- utility classes (e.g., leading-6) are being stripped out from the final output, while other Tailwind utilities work correctly.
Steps to reproduce:
Using tailwind-merge in a utility function:
Using the utility with a leading- class:
Expected behavior:
The leading-XYZ class should be preserved in the final output
Actual behavior:
The leading-XYZ class is stripped out
Other Tailwind utilities (like gap-4, etc) work correctly. Seems to solely be an issue with 'leading' that I tested.
Using clsx alone without tailwind-merge preserves the leading- classes correctly.
This is being used in a monorepo setup w/ Turborepo, here's my package.json for the
ui
package that the util function is exported from.The text was updated successfully, but these errors were encountered: