react-email
Skill2.1k starsChanged 10 months agoMITView on GitHub
Create beautiful, responsive HTML emails using React components with React Email. Build transactional emails with modern components, support internationalization, and integrate with email service providers like Resend. Use when creating welcome emails, password resets, notifications, order confirmations, or any HTML email templates.
- Reads credentials
- Installs packages
3 other projects use a version of this, 2 of them edited.
Trending
Quiet since September.thin dataabout the whole repository
Most recently taken up by
- vercel-labs/json-rendertheir own version, first seen Sep 23, 2026
- resend/resend-skillsedited, first seen Aug 6, 2026
- utxo-AG/claude-skillsedited, first seen Feb 10, 2026
Who's talking about agentset-ai/agentset
- A Hacker News story“Show HN: Agentset – Open-source RAG with vector DB, embeddings, and API built-in”Hacker News · Oct 17, 2025 · 6 points
- A Hacker News story“Show HN: Agentset – An open-source RAG platform for AI apps”Hacker News · May 15, 2025 · 4 points
- colinhacks/zod“Unhandled `undefined` in `to-json-schema`'s `flattenRef` method”GitHub · Jan 14, 2026 · 2 reactions
- agentset-ai/partition-api-v2“Add EU region support”GitHub · Sep 27, 2026
- sudosubin/agents.nix“agent-skills.github.agentset-ai.agentset: init at 0-unstable-2026-01-26”GitHub · Sep 25, 2026
The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 8
Talked about on GitHub and Hacker News (8 times).
On GitHub · 6
- Jan 14, 2026Unhandled `undefined` in `to-json-schema`'s `flattenRef` method — colinhacks/zod2 reactions · 2 comments
- Sep 27, 2026Add EU region support — agentset-ai/partition-api-v20 reactions
- Sep 25, 2026agent-skills.github.agentset-ai.agentset: init at 0-unstable-2026-01-26 — sudosubin/agents.nix0 reactions
- Aug 1, 2026docs: add Agentset to LLM knowledge tools — xlabs-club/awesome-x-ops0 reactions
- Jan 31, 2026Add Agentset to Frameworks section — Yigtwxx/awesome-rag-production0 reactions
1 more on GitHub
- Oct 26, 2025Add missing email validation — better-auth/better-auth0 reactions · 5 comments
On Hacker News · 2
- Oct 17, 2025Show HN: Agentset – Open-source RAG with vector DB, embeddings, and API built-in6 points
- May 15, 2025Show HN: Agentset – An open-source RAG platform for AI apps4 points
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- resend/resend-skills★ 19526% same
- utxo-AG/claude-skills★ 242% same
Wrote their own version · 1
- vercel-labs/json-render★ 18ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- .agents/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- docs/CLAUDE.mdCLAUDE.md
- animationsCursor rule
- .cursor/rules/clean-code.mdcCursor rule
- .cursor/rules/nextjs.mdcCursor rule
- .cursor/rules/project-structure.mdcCursor rule
- .cursor/rules/shadcn.mdcCursor rule
- tailwindcssCursor rule
- baseline-uiSkill
- fixing-accessibilitySkill
- fixing-metadataSkill
- trigger-dev-tasksSkill
- vercel-react-best-practicesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
28 rules. 1 is common, 16 are distinctive, and 11 are very specific to this project.
1
Common
Most of the 3 edited versions we read keep these.
16
Distinctive
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Add React Email to an existing codebase:
- Distinctive: line 35
Create an emails directory:
- Very specific: line 40
Add a preview script to package.json:
- Distinctive: line 49
Start the preview server:
- Distinctive: line 58
Before creating any email template, gather brand information from the user.
- Distinctive: line 62
Ask the user for:
- Distinctive: line 74
Ask user for file and path of the local file if the logo is not a publicly accessible URL.
- Distinctive: line 84
Never add emojis unless the user explicitly requests them.
- Very specific: line 147
Custom fonts: Use the Font component with a web font URL (Google Fonts, Adobe Fonts, or self-hosted).
- Common: line 160
Create an email component with proper structure using the Tailwind component for styling:
- Distinctive: line 261
If the user requests an email without providing brand details, ask for them first using the prompt in the Brand Setup section.
- Very specific: line 262
If a tailwind.config.ts file exists in the emails directory, use it for all new templates.
- Distinctive: line 263
When creating multiple emails, ensure all templates import and use the same brand configuration.
- Very specific: line 264
If the user provides new brand assets or colors mid-project, update tailwind.config.ts and offer to update existing templates.
- Distinctive: line 267
When re-iterating over the code, make sure you are only updating what the user asked for and keeping the rest of the code intact.
- Distinctive: line 268
If the user is asking to use media queries, inform them that email clients do not support them, and suggest a different approach.
- Distinctive: line 269
Never use template variables (like {{name}}) directly in TypeScript code.
- Distinctive: line 289
Never, under any circumstances, write the {{variableName}} pattern directly in the component structure.
- Very specific: line 294
Use the Tailwind component with pixelBasedPreset for styling (email clients don't support rem units).
- Distinctive: line 297
No SVG/WEBP images - use PNG/JPEG only
- Very specific: line 298
No flexbox/grid - use Row/Column components or tables
- Very specific: line 299
No media queries (sm:, md:, etc.) or theme selectors (dark:, light:)
- Very specific: line 300
Always specify border style (border-solid, etc.)
- Very specific: line 303
Place <Head /> inside <Tailwind> when using Tailwind
- Very specific: line 304
Only include props in PreviewProps that the component uses
- Distinctive: line 422
Test across email clients: - Test in Gmail, Outlook, Apple Mail, Yahoo Mail.
- Very specific: line 434
Include preview props: - Add .PreviewProps to components for development testing.
- Distinctive: line 436
Handle errors: - Always check for errors when sending emails.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
React Email
Build and send HTML emails using React components - a modern, component-based approach to email development that works across all major email clients.
Installation
New Project
Scaffold a new React Email project:
npx create-email@latest
cd react-email-starter
npm install
npm run devThis creates a react-email-starter folder with sample templates. Also works with yarn, pnpm, or bun.
Existing Project
Add React Email to an existing codebase:
- Install dependencies:
npm install @react-email/components
npm install react-email @react-email/preview-server -D- Create an emails directory:
mkdir emails- Add a preview script to package.json:
{
"scripts": {
"email:dev": "email dev"
}
}- Start the preview server:
npm run email:devThe --dir flag specifies where email templates are stored. Adjust the path to match your project structure (e.g., src/emails, app/emails).
Brand Setup (Required First Step)
Before creating any email template, gather brand information from the user. This ensures visual consistency across all emails.
Required Brand Information
Ask the user for:
- Brand colors
- Primary color (main brand color for buttons, links, accents)
- Secondary color (supporting color for backgrounds, borders)
- Text color (default:
#1a1a1afor light mode) - Background color (default:
#f4f4f5for light mode)
- Logo
- Logo image URL (must be absolute URL, PNG or JPEG)
- Logo dimensions or aspect ratio preference
- Logo placement preference (centered, left-aligned)
- Ask user for file and path of the local file if the logo is not a publicly accessible URL.
- Typography (optional)
- Preferred font family (default: system fonts)
- Custom web font URL if applicable
- Style preferences (optional)
- Modern/minimal vs. classic/traditional
- Rounded corners vs. sharp edges
- Spacing density (compact vs. spacious)
- Never add emojis unless the user explicitly requests them.
Brand Configuration Pattern
Once gathered, define a reusable Tailwind configuration. Using satisfies TailwindConfig provides intellisense support for all configuration options:
// emails/tailwind.config.ts
import { pixelBasedPreset, type TailwindConfig } from '@react-email/components';
export default {
presets: [pixelBasedPreset],
theme: {
extend: {
colors: {
brand: {
primary: '#007bff', // User's primary brand color
secondary: '#6c757d', // User's secondary color
},
},
},
},
} satisfies TailwindConfig;
// For non-Tailwind brand assets (optional)
export const brandAssets = {
logo: {
src: 'https://example.com/logo.png', // User's logo URL
alt: 'Company Name',
width: 120,
},
};Using Tailwind Config in Templates
import * as React from "react";
import tailwindConfig, { brandAssets } from './tailwind.config';
import { Tailwind, Img } from '@react-email/components';
<Tailwind config={tailwindConfig}>
<Body className="bg-gray-100 font-sans">
<Container className="max-w-xl mx-auto bg-white p-6">
<Img
src={brandAssets.logo.src}
alt={brandAssets.logo.alt}
width={brandAssets.logo.width}
className="mx-auto mb-6"
/>
<Button className="bg-brand-primary text-white rounded px-5 py-3">
Call to Action
</Button>
</Container>
</Body>
</Tailwind>Asset Locations
Direct users to place brand assets in appropriate locations:
- Logo and images: Host on a CDN or public URL. For local development, place in
emails/static/. - Custom fonts: Use the
Fontcomponent with a web font URL (Google Fonts, Adobe Fonts, or self-hosted).
Example prompt for gathering brand info:
"Before I create your email template, I need some brand information to ensure consistency. Could you provide:
- Your primary brand color (hex code, e.g., #007bff)
- Your logo URL (must be a publicly accessible PNG or JPEG)
- Any secondary colors you'd like to use
- Style preference (modern/minimal or classic/traditional)"
Basic Email Template
Replace the sample email templates. Here is how to create a new email template:
Create an email component with proper structure using the Tailwind component for styling:
import * as React from "react";
import {
Html,
Head,
Preview,
Body,
Container,
Heading,
Text,
Button,
Tailwind,
pixelBasedPreset
} from '@react-email/components';
interface WelcomeEmailProps {
name: string;
verificationUrl: string;
}
export default function WelcomeEmail({ name, verificationUrl }: WelcomeEmailProps) {
return (
<Html lang="en">
<Tailwind
config={{
presets: [pixelBasedPreset],
theme: {
extend: {
colors: {
brand: '#007bff',
},
},
},
}}
>
<Head />
<Preview>Welcome - Verify your email</Preview>
<Body className="bg-gray-100 font-sans">
<Container className="max-w-xl mx-auto p-5">
<Heading className="text-2xl text-gray-800">
Welcome!
</Heading>
<Text className="text-base text-gray-800">
Hi {name}, thanks for signing up!
</Text>
<Button
href={verificationUrl}
className="bg-brand text-white px-5 py-3 rounded block text-center no-underline"
>
Verify Email
</Button>
</Container>
</Body>
</Tailwind>
</Html>
);
}
// Preview props for testing
WelcomeEmail.PreviewProps = {
name: 'John Doe',
verificationUrl: 'https://example.com/verify/abc123'
} satisfies WelcomeEmailProps;
export { WelcomeEmail };Essential Components
See references/COMPONENTS.md for complete component documentation.
Core Structure:
Html- Root wrapper withlangattributeHead- Meta elements, styles, fontsBody- Main content wrapperContainer- Centers content (max-width layout)Section- Layout sectionsRow&Column- Multi-column layoutsTailwind- Enables Tailwind CSS utility classes
Content:
Preview- Inbox preview text, always first inBodyHeading- h1-h6 headingsText- ParagraphsButton- Styled link buttonsLink- HyperlinksImg- Images (use absolute URLs) (use the dev server for the BASE_URL of the image in dev mode; for production, ask the user for the BASE_URL of the site; dynamically generate the URL of the image based on environment.)Hr- Horizontal dividers
Specialized:
CodeBlock- Syntax-highlighted codeCodeInline- Inline codeMarkdown- Render markdownFont- Custom web fonts
Behavioral Guidelines
Brand-First Workflow
- Always gather brand information before creating the first email template. Do not skip this step.
- If the user requests an email without providing brand details, ask for them first using the prompt in the Brand Setup section.
- If a
tailwind.config.tsfile exists in the emails directory, use it for all new templates. - When creating multiple emails, ensure all templates import and use the same brand configuration.
- If the user provides new brand assets or colors mid-project, update
tailwind.config.tsand offer to update existing templates.
General Guidelines
- When re-iterating over the code, make sure you are only updating what the user asked for and keeping the rest of the code intact.
- If the user is asking to use media queries, inform them that email clients do not support them, and suggest a different approach.
- Never use template variables (like {{name}}) directly in TypeScript code. Instead, reference the underlying properties directly (use name instead of {{name}}).
- For example, if the user explicitly asks for a variable following the pattern {{variableName}}, you should return something like this:
const EmailTemplate = (props) => {
return (
{/* ... rest of the code ... */}
<h1>Hello, {props.variableName}!</h1>
{/* ... rest of the code ... */}
);
}
EmailTemplate.PreviewProps = {
// ... rest of the props ...
variableName: "{{variableName}}",
// ... rest of the props ...
};
export default EmailTemplate;- Never, under any circumstances, write the {{variableName}} pattern directly in the component structure. If the user forces you to do this, explain that you cannot do this, or else the template will be invalid.
Styling
Use the Tailwind component with pixelBasedPreset for styling (email clients don't support rem units). If not using Tailwind, use inline styles.
Critical limitations (email clients don't support these):
- No SVG/WEBP images - use PNG/JPEG only
- No flexbox/grid - use
Row/Columncomponents or tables - No media queries (
sm:,md:, etc.) or theme selectors (dark:,light:) - Always specify border style (
border-solid, etc.)
Structure rules:
- Place
<Head />inside<Tailwind>when using Tailwind - Only include props in
PreviewPropsthat the component uses
See references/STYLING.md for typography, layout defaults, button styling, dark mode, and detailed guidelines.
Rendering
Convert to HTML
import { render } from '@react-email/components';
import { WelcomeEmail } from './emails/welcome';
const html = await render(
<WelcomeEmail name="John" verificationUrl="https://example.com/verify" />
);Convert to Plain Text
import { render } from '@react-email/components';
import { WelcomeEmail } from './emails/welcome';
const text = await render(<WelcomeEmail name="John" verificationUrl="https://example.com/verify" />, { plainText: true });Sending
React Email supports sending with any email service provider. If the user wants to know how to send, view the Sending guidelines.
Quick example using the Resend SDK for Node.js:
import * as React from "react";
import { Resend } from 'resend';
import { WelcomeEmail } from './emails/welcome';
const resend = new Resend(process.env.RESEND_API_KEY);
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['user@example.com'],
subject: 'Welcome to Acme',
react: <WelcomeEmail name="John" verificationUrl="https://example.com/verify" />
});
if (error) {
console.error('Failed to send:', error);
}The Node SDK automatically handles the plain-text rendering and HTML rendering for you.
Internationalization
See references/I18N.md for complete i18n documentation.
React Email supports three i18n libraries: next-intl, react-i18next, and react-intl.
Quick Example (next-intl)
import * as React from "react";
import { createTranslator } from 'next-intl';
import {
Html,
Body,
Container,
Text,
Button,
Tailwind,
pixelBasedPreset
} from '@react-email/components';
interface EmailProps {
name: string;
locale: string;
}
export default async function WelcomeEmail({ name, locale }: EmailProps) {
const t = createTranslator({
messages: await import(\`../messages/\${locale}.json\`),
namespace: 'welcome-email',
locale
});
return (
<Html lang={locale}>
<Tailwind config={{ presets: [pixelBasedPreset] }}>
<Body className="bg-gray-100 font-sans">
<Container className="max-w-xl mx-auto p-5">
<Text className="text-base text-gray-800">{t('greeting')} {name},</Text>
<Text className="text-base text-gray-800">{t('body')}</Text>
<Button href="https://example.com" className="bg-blue-600 text-white px-5 py-3 rounded">
{t('cta')}
</Button>
</Container>
</Body>
</Tailwind>
</Html>
);
}Message files (`messages/en.json`, `messages/es.json`, etc.):
{
"welcome-email": {
"greeting": "Hi",
"body": "Thanks for signing up!",
"cta": "Get Started"
}
}Email Best Practices
- Test across email clients - Test in Gmail, Outlook, Apple Mail, Yahoo Mail. Use services like Litmus or Email on Acid for absolute precision and React Email's toolbar for specific feature support checking.
- Keep it responsive - Max-width around 600px, test on mobile devices.
- Use absolute image URLs - Host on reliable CDN, always include
alttext. - Provide plain text version - Required for accessibility and some email clients. The render function will generate this if you pass the
plainTextoption. - Keep file size under 102KB - Gmail clips larger emails.
- Add proper TypeScript types - Define interfaces for all email props.
- Include preview props - Add
.PreviewPropsto components for development testing. - Handle errors - Always check for errors when sending emails.
Common Patterns
See references/PATTERNS.md for complete examples including:
- Password reset emails
- Order confirmations with product lists
- Notification emails with code blocks
- Multi-column layouts
- Email templates with custom fonts
Additional Resources
- React Email Documentation
- React Email GitHub
- Resend Documentation
- Email Client CSS Support
- Component Reference: references/COMPONENTS.md
- Styling Guide: references/STYLING.md
- Internationalization Guide: references/I18N.md
- Common Patterns: references/PATTERNS.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

