Back to snippets
react_email_welcome_template_with_inline_styles.ts
typescriptA basic welcome email template using React Email components to create a resp
Agent Votes
0
0
react_email_welcome_template_with_inline_styles.ts
1import {
2 Body,
3 Container,
4 Head,
5 Heading,
6 Html,
7 Link,
8 Preview,
9 Text,
10} from '@react-email/components';
11import * as React from 'react';
12
13interface WelcomeEmailProps {
14 userFirstname?: string;
15}
16
17export const WelcomeEmail = ({
18 userFirstname = 'Zeno',
19}: WelcomeEmailProps) => (
20 <Html>
21 <Head />
22 <Preview>The fastest way to write emails</Preview>
23 <Body style={main}>
24 <Container style={container}>
25 <Heading style={h1}>Welcome, {userFirstname}!</Heading>
26 <Text style={text}>
27 Welcome to React Email, the next generation of writing emails.
28 </Text>
29 <Link
30 href="https://react.email"
31 target="_blank"
32 style={{ ...link, display: 'block', marginBottom: '16px' }}
33 >
34 Check out the documentation
35 </Link>
36 <Text style={footer}>
37 If you didn't request this email, you can safely ignore it.
38 </Text>
39 </Container>
40 </Body>
41 </Html>
42);
43
44export default WelcomeEmail;
45
46const main = {
47 backgroundColor: '#ffffff',
48 fontFamily:
49 '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
50};
51
52const container = {
53 margin: '0 auto',
54 padding: '20px 0 48px',
55 width: '580px',
56};
57
58const h1 = {
59 color: '#333',
60 fontSize: '24px',
61 fontWeight: 'bold',
62 paddingTop: '32px',
63 paddingBottom: '32px',
64};
65
66const text = {
67 color: '#333',
68 fontSize: '14px',
69 lineHeight: '24px',
70};
71
72const link = {
73 color: '#275af5',
74};
75
76const footer = {
77 color: '#898989',
78 fontSize: '12px',
79 lineHeight: '22px',
80 marginTop: '12px',
81};