Closed kratess closed 2 weeks ago
Hey @kratess! 👋
The reason why the leading-1.25
class gets removed is because text-14
sets a line-height CSS property, overriding line-height classes if you place it afterwards. 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'
const twMerge = extendTailwindMerge({
override: {
conflictingClassGroups: {
// In the default config the value is ['leading']
// See https://github.com/dcastil/tailwind-merge/blob/v2.5.4/src/lib/default-config.ts#L1786
'font-size': []
}
},
// … rest of your config
})
Related: https://github.com/dcastil/tailwind-merge/issues/446, https://github.com/dcastil/tailwind-merge/issues/257, https://github.com/dcastil/tailwind-merge/issues/218, https://github.com/dcastil/tailwind-merge/issues/187, https://github.com/dcastil/tailwind-merge/issues/59
Hi @dcastil
Indeed only native font-size of tailwind has the line-height set. Custom-ones i made does not have that feature.
But yeah, conflictingClassGroups
solved my issue. Thanks
Describe the bug
To Reproduce
results in this:
block bg-white text-gray1 border-gray4 placeholder-opacity-50 rounded-5 outline-none text-14 w-100 border-0
Expected behavior
block bg-white text-gray1 leading-1.25 border-gray4 placeholder-opacity-50 rounded-5 outline-none text-14 w-100 border-0