Skip to content

twMerge outputs empty class #247

Closed Answered by dcastil
shinokada asked this question in Help
Discussion options

You must be logged in to vote

Hey @shinokada! 👋

tailwind-merge doesn't support the object syntax (here more info on why).

Does it work if you rewrite the call to twMerge to this?

twMerge(
    footerType === 'sitemap' && 'bg-gray-800',
    footerType === 'socialmedia' && 'p-4 bg-white sm:p-6 dark:bg-gray-800',
    footerType === 'logo' && 'p-4 bg-white rounded-lg shadow md:px-6 md:py-8 dark:bg-gray-800',
    footerType === 'default' &&
        'p-4 bg-white rounded-lg shadow md:flex md:items-center md:justify-between md:p-6 dark:bg-gray-800',
    $$props.class,
)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@shinokada
Comment options

Answer selected by shinokada
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
context-v1 Related to tailwind-merge v1
2 participants