tailwind-merge

A JavaScript library that removes Tailwind classes overridden by later ones in the same list, such as dropping p-4 when px-6 follows.

In more detail

It understands which utilities set the same CSS property, so it keeps only the last of a conflicting group. That makes class overrides predictable regardless of how the stylesheet orders the rules.

Related terms

Taught in

References