react-email
react-email copied to clipboard
Tailwind styles not overwriting default <Text> styles
Currently, the inline styles default to the Text component take precedence over tailwind styles that I'm passing to it.
My workaround
<Text
style={{
margin : undefined,
fontSize: undefined,
lineHeight: undefined,
}}
className="m-0 text-sm"
>
I did some more investigating because I noticed that there were tests for this situation.
I looks like there may be 2 issues:
- when a div has a responsive tailwind class (ex.
sm:w-1), all classes get hoisted to the<head>instead of being inline. - when no responsive classes are used on non email components, then responsive styles are not applied.
example
<div className="w-1.5" />
<Text className="text-sm sm:text-md" />
turns into
<html>
<head></head>
<body>
<div style=\\"width:0.375rem\\"></div>
<p style=\\"font-size:0.875rem;line-height:1.25rem;margin:16px 0\\"></p>
</body>
</html>