Replies: 1 comment 4 replies
-
Hey @rjvim! 👋 You're right, tailwind-merge should ideally remove the
Hope that explanation helps. But I have to admit that it looks weird to leave the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for this library and initiative, This aims to solve a big use for me while building UI components for react/vue. Usually, when the components give default styling, overriding them is immense pain, and the developer who is developing the component has to give various props to override such classes. But by using this library, a developer can override existing props in the most minimal way; at least, that's how I visualize its usage.
I have tried playing around and found a gap.
If we take an example like follows:
The output from library is:
p-3 py-2 px-4
Shouldn't it be:
py-2 px-4
? Is that what this library is aiming to do?If I take some use cases, I think it would be more useful if merging is intelligent like follows:
twMerge('p-3', 'py-2 px-4')
=py-2 px-4
twMerge('p-3', 'px-4')
=py-3 px-4
twMerge('p-3', 'py-4')
=px-3 py-4
twMerge('p-3', 'pl-4')
=pl-4 pr-3 py-4
(This kind of breakdown gives ability to override props with much more power)Please let me know if the examples I presented are part of the roadmap or I misunderstood the library's purpose.
Beta Was this translation helpful? Give feedback.
All reactions