@@ -47,12 +47,13 @@ pnpm add @react-email/tailwind -E
47
47
Add the component around your email body content.
48
48
49
49
``` jsx
50
- import { Tailwind , Button } from " @react-email/components" ;
50
+ import { Tailwind , pixelBasedPreset , Button } from " @react-email/components" ;
51
51
52
52
const Email = () => {
53
53
return (
54
54
< Tailwind
55
55
config= {{
56
+ presets: [pixelBasedPreset],
56
57
theme: {
57
58
extend: {
58
59
colors: {
@@ -83,77 +84,9 @@ const Email = () => {
83
84
<Info >
84
85
Most email clients are style-limited and some styles may not work.
85
86
86
- One example of this is how Tailwind uses ` rem ` as its main unit for
87
- better accessibility. This is not supported by [ some email
88
- clients] ( https://www.caniemail.com/features/css-unit-rem/ ) , if you want you
89
- can override the Tailwind config.
90
-
91
- We can't really apply this configuration for you as it would have a few
92
- drawbacks. In the future, we will probably provide a preset to remediate this.
93
- But, for now, here's a good starter configuration you can use to avoid these issues:
94
-
95
- <Accordion title = " Tailwind configuration with px instead of rem" >
96
- ``` typescript tailwind.config.ts
97
- import type { TailwindConfig } from " @react-email/tailwind" ;
98
-
99
- export default {
100
- theme: {
101
- fontSize: {
102
- xs: [" 12px" , { lineHeight: " 16px" }],
103
- sm: [" 14px" , { lineHeight: " 20px" }],
104
- base: [" 16px" , { lineHeight: " 24px" }],
105
- lg: [" 18px" , { lineHeight: " 28px" }],
106
- xl: [" 20px" , { lineHeight: " 28px" }],
107
- " 2xl" : [" 24px" , { lineHeight: " 32px" }],
108
- " 3xl" : [" 30px" , { lineHeight: " 36px" }],
109
- " 4xl" : [" 36px" , { lineHeight: " 36px" }],
110
- " 5xl" : [" 48px" , { lineHeight: " 1" }],
111
- " 6xl" : [" 60px" , { lineHeight: " 1" }],
112
- " 7xl" : [" 72px" , { lineHeight: " 1" }],
113
- " 8xl" : [" 96px" , { lineHeight: " 1" }],
114
- " 9xl" : [" 144px" , { lineHeight: " 1" }],
115
- },
116
- spacing: {
117
- px: " 1px" ,
118
- 0 : " 0" ,
119
- 0.5 : " 2px" ,
120
- 1 : " 4px" ,
121
- 1.5 : " 6px" ,
122
- 2 : " 8px" ,
123
- 2.5 : " 10px" ,
124
- 3 : " 12px" ,
125
- 3.5 : " 14px" ,
126
- 4 : " 16px" ,
127
- 5 : " 20px" ,
128
- 6 : " 24px" ,
129
- 7 : " 28px" ,
130
- 8 : " 32px" ,
131
- 9 : " 36px" ,
132
- 10 : " 40px" ,
133
- 11 : " 44px" ,
134
- 12 : " 48px" ,
135
- 14 : " 56px" ,
136
- 16 : " 64px" ,
137
- 20 : " 80px" ,
138
- 24 : " 96px" ,
139
- 28 : " 112px" ,
140
- 32 : " 128px" ,
141
- 36 : " 144px" ,
142
- 40 : " 160px" ,
143
- 44 : " 176px" ,
144
- 48 : " 192px" ,
145
- 52 : " 208px" ,
146
- 56 : " 224px" ,
147
- 60 : " 240px" ,
148
- 64 : " 256px" ,
149
- 72 : " 288px" ,
150
- 80 : " 320px" ,
151
- 96 : " 384px" ,
152
- },
153
- },
154
- } satisfies TailwindConfig ;
155
- ```
156
- </Accordion >
87
+ One example of this is how Tailwind uses ` rem ` as its main unit for better accessibility. This
88
+ is not supported by [ some email clients] ( https://www.caniemail.com/features/css-unit-rem/ ) , and
89
+ the ` pixelBasedPreset ` changes it so that the styles are based on ` 16px ` instead.
157
90
</Info >
158
91
159
92
## Live example
0 commit comments