Merge function does not work with custom box shadow classes
See original GitHub issueHello, thanks for this awesome package.
I noticed an issue with the twMerge
function when using custom box shadow classes.
// Actual
twMerge('shadow-md shadow-lg shadow-light shadow-dark') // 'shadow-lg shadow-light shadow-dark'
// Expected
twMerge('shadow-md shadow-lg shadow-light shadow-dark') // 'shadow-dark'
This works properly with the normal box shadow classes.
Perhaps I to make a custom tailwind merge function with the light and dark suffixes? Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
css merge box shadows - Stack Overflow
However, because there are two shadows between each element, I get a shadow two times thicker between them. navigation bar. Is there a...
Read more >box-shadow - CSS: Cascading Style Sheets - MDN Web Docs
The box-shadow CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is...
Read more >box-shadow - CSS-Tricks
The box-shadow property in CSS is for putting shadows on elements (sometimes referred to as “drop shadows”, ala Photoshop/Figma).
Read more >[Feature Proposal] Coloured Box Shadow · Issue #654 - GitHub
Heya, I think it'd be neat if box shadows worked with colour ... It would generate a lot of classes that most people...
Read more >Using box-shadow to construct a border | Codementor
box -shadow is a wonderful property. Use it to draw simple borders with CSS.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @charkour! Indeed, if you’re using a custom Tailwind config, you need to use
createTailwindMerge
and create a config for it. You don’t needcreateTailwindMerge
in all cases, but in this one yes.Here is how to create it in
v0.7.1
:In
v0.8.0
which will be released soon you can do it a little cleaner:If you’re wondering where that class group name
shadow
comes from, it is specified in the default config here. So far there is no straight forward way to figure out which property to access but to look into the source code.Let me know if that helps.
Moving this to discussions as this isn’t a bug in tailwind-merge.