resend / react-email Goto Github PK
View Code? Open in Web Editor NEWπ Build and send emails using React
Home Page: https://react.email
License: MIT License
π Build and send emails using React
Home Page: https://react.email
License: MIT License
A thin horizontal line that separates content areas built on top of <hr>
.
Eg:
import { Html } from '@react-email/html';
import { Divider } from '@react-email/divider';
const Email = () => {
return (
<Html lang="en">
<Divider />
</Html>
);
};
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of a welcome email.
Original: welcome-to-stripe.eml.zip
This could be an icon next to the copy to clipboard icon.
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of a receipt email.
Original: Your receipt from Apple.eml.zip
An Html
component to wrap the email content.
Eg:
import { Button } from '@react-email/button';
import { Html } from '@react-email/html';
const Email = () => {
return (
<Html lang="en">
<Button href="https://example.com" style={{ color: '#61dafb' }}>
Click me
</Button>
</Html>
);
};
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of a review email.
Original: Read Alexβs review.eml.zip
Use juice to inline styles.
import { MyTemplate } from '../components/MyTemplate';
import { render } from '@react-email/render';
const options = {
inline: true
};
const html = render(<MyTemplate firstName="Jim" />, options);
Be able to render React components and append a DOCTYPE needed for email.
Nowadays, you have to reload every time you make a change. I'm not sure if that's because of the iframe or something else.
Display a responsive image in your email.
Eg:
import { Html } from '@react-email/html';
import { Img } from '@react-email/img';
const Email = () => {
return (
<Html>
<Img src="cat.jpg" alt="Cat" width="300" />
</Html>
);
};
Think of it as create-react-app
but for email.
Similar:
Use js-beautify as a dependency.
import { MyTemplate } from '../components/MyTemplate';
import { render } from '@react-email/render';
const options = {
prettify: true
};
const html = render(<MyTemplate firstName="Jim" />, options);
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of a reset password email.
Original: Reset your Dropbox password.eml.zip
Same as #98
The idea is to have a solution for local development, so you don't need to send real emails while testing things out.
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of a confirmation code email.
Original: Slack confirmation code_ DJZ-TLX.eml.zip
Defines an ordered list using a decimal style by default.
import { Html } from '@react-email/html';
import { Ol } from '@react-email/ol';
const Email = () => {
return (
<Html lang="en">
<Ol>
<li>foo</li>
<li>bar</li>
</Ol>
</Html>
);
};
This is used for defining an inline sample of code.
import { Html } from '@react-email/html';
import { Code } from '@react-email/code';
const Email = () => {
return (
<Html lang="en">
<Code>foo</Code>
</Html>
);
};
We can have a button to copy code to clipboard and also download it locally.
Defines an unordered list using a bullet style by default.
import { Html } from '@react-email/html';
import { Ul } from '@react-email/ul';
const Email = () => {
return (
<Html lang="en">
<Ul>
<li>foo</li>
<li>bar</li>
</Ul>
</Html>
);
};
Whenever the user passes a style prop with padding, we should have an util to handle the padding by adding the msoPaddingAlt
attribute as well.
const padding = (style: React.CSSProperties) => {
// Check if there's any padding
return { ...style, msoPaddingAlt: style.padding }
}
Animation Inspiration: Family
import { Html } from '@react-email/html';
import { P } from '@react-email/p';
const Email = () => {
return (
<Html lang="en">
<P>Lorem ipsum</P>
</Html>
);
};
Not much you need to do here, mostly a wrapper around <h1>
, <h2>
, etc.
Eg:
import { Html } from '@react-email/html';
import { Heading } from '@react-email/heading';
const Email = () => {
return (
<Html lang="en">
<Heading size="1">Lorem</Heading>
<Heading size="2">Ipsum</Heading>
<Heading size="3">Dolor</Heading>
<Heading size="4">Sit</Heading>
<Heading size="5">Amet</Heading>
<Heading size="6">Consectetur</Heading>
</Html>
);
};
A Head
component that contains all related <head />
content.
When trying to find the component, it's way harder to find the right P
since the letter may come from a text instead of the component.
Eg:
// cmd + f to find all `P` components to replace, the search will return the `P`s from `Ponei` and `Piano` as well.
<div>
<P>Ponei</P>
<P>Piano</P>
</div>
Domain: demo.react.email
This is used to preserve spaces, line breaks and tabs in the text. So how you format the code in the HTML file is how it will look on the screen.
import { Html } from '@react-email/html';
import { Pre } from '@react-email/pre';
const Email = () => {
return (
<Html lang="en">
<Pre>foo bar</Pre>
</Html>
);
};
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of a password change email.
A text snippet that appears under the subject line in the inbox but is hidden from the main email content when itβs opened.
Eg:
import { Html } from '@react-email/html';
import { Preheader } from '@react-email/preheader';
const Email = () => {
return (
<Html lang="en">
<Preheader text="Lorem ipsum" />
</Html>
);
};
A component for internal usage to be used to replace the usage of the not so sexy syntax for outlook
The style props doesn't override the default styles.
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of an order confirmation email.
Original: Looking for Your Nike Order.eml.zip
We currently have the following API for our Avatar component:
<Avatar>
<AvatarImage src="cat.jpg" />
<AvatarFallback>My Cat</AvatarFallback>
</Avatar>
I believe we could follow the pattern used by Chakra's Avatar and have everything in one tag instead:
<Avatar name="Dan Abrahmov" src="https://bit.ly/dan-abramov" />
What do you think @petersonmedina @bukinoshita?
It's important that we try to recreate real emails in order to validate the quality and developer experience of our components. This is an example of a magic link email.
Original: Your temporary Notion login.eml.zip
Something to give the content a max-width
and center it in the email body. Maybe include props for max-width values and alignment?
import { Button } from '@react-email/button';
import { Html } from '@react-email/html';
import { Container } from '@react-email/container';
const Email = () => {
return (
<Html lang="en">
<Container maxWidth="400" align="center" style={{ backgroundColor: '#fff' }}>
<Button href="https://example.com" style={{ color: '#61dafb' }}>
Click me
</Button>
</Container>
</Html>
);
};
import { Html } from '@react-email/html';
import { A } from '@react-email/a';
const Email = () => {
return (
<Html lang="en">
<A href="https://example.com">Example</A>
</Html>
);
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.