Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not override class with custom class in tailwind-merge #207

Closed
nguyenthanhan201 opened this issue Mar 3, 2023 · 2 comments
Closed
Labels
context-v1 Related to tailwind-merge v1

Comments

@nguyenthanhan201
Copy link

this is my custom class btn
.btn { @apply relative inline-flex min-w-16 cursor-pointer items-center justify-center rounded-lg leading-tight outline-none py-3 px-5 gap-2; }

then i use merge
twMerge( "btn", classVariants(variant), className )

@dcastil
Copy link
Owner

dcastil commented Mar 3, 2023

Hey @nguyenthanhan201! 👋

You need to configure tailwind-merge to understand your custom class. But I don't recommend using @apply together with tailwind-merge. Here is more info on that and an alternative way to do what you want: https://github.com/dcastil/tailwind-merge/blob/v1.10.0/docs/recipes.md#extracting-classes-with-tailwinds-apply

@nguyenthanhan201
Copy link
Author

Hey @nguyenthanhan201! 👋

You need to configure tailwind-merge to understand your custom class. But I don't recommend using @apply together with tailwind-merge. Here is more info on that and an alternative way to do what you want: https://github.com/dcastil/tailwind-merge/blob/v1.10.0/docs/recipes.md#extracting-classes-with-tailwinds-apply

Thank for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context-v1 Related to tailwind-merge v1
Projects
None yet
Development

No branches or pull requests

2 participants