-
Notifications
You must be signed in to change notification settings - Fork 861
chore(tailwind): Add support for responsive classes and custom nested components #502
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
chore(tailwind): Add support for responsive classes and custom nested components #502
Conversation
|
Could we get this merged soon? It's very critical for my use case |
|
Thanks @vinicoder ! |
Got it! This happens because the component's default styles override Tailwind's styles (you can do a test by replacing the Button component with an anchor/div tag or any other tag). I'm fixing this and will send a PR later today. Thanks for reporting @ysm-dev! I will also add this to the test coverage. |
|
hey - any update on this? thanks! |


This PR brings some upgrades to the Tailwind component:
🌈 Support for responsive styles:
Using responsive styles is not something that can be done inline, so when adding responsive styles, the component will automatically place its code in the
styletag inside theheadtag of your email, which is whyhtmlandheadtags are required in your code. For example:Some changes were also necessary to make this happen, such as escaping the class names because some email clients do not support them.
🎁 Support for custom nested components:
In the past, we used
React.Childrento nest components. But it didn't play nice with children that had more than one node element or nochildrendefined. Not cool. Now, this component reads all the content, renders it, and applies the right styles.🧪 Bonus: Unit tests
Additionally, unit tests were implemented to ensure that most of the features are working correctly.

🚨 Important
Although we're using Tailwind, not all CSS properties work across all email clients. So while it gives you the freedom to create, it's up to you to decide what you want to prioritize. If you need clarification on what's good or not for your email, check out https://www.caniemail.com/.
Should fix: #462, #448, #451