Use JSX email to build production-ready email templates with React and TypeScript. Prefer JSX email components and helpers from `jsx-email` for email-client compatibility. Use `render` to generate HTML strings for providers like Resend, Postmark, SendGrid, Nodemailer, AWS SES, Loops, or Plunk, and use the CLI preview/check/build workflow while developing. Favor simple, standards-compliant email markup, account for inconsistent email client CSS support, use the `Tailwind` component when utility styling is helpful, and run `email check` before sending when compatibility matters. For complete agent-readable documentation, fetch https://jsx.email/llms-full.txt before implementing. Implement or refactor with the `Tailwind` component when it fits the email's content and layout. Wrap only the content that uses utility classes. Use UnoCSS-compatible config, prefer utilities that compile to email-safe CSS, and set `production` when Gmail class limits matter. Reference the component docs at https://jsx.email/docs/components/tailwind.
A JSX email component which enables using Tailwind-style CSS to style emails
pnpm
aube
bun
npm
yarn
pnpm add jsx-email
aube add jsx-email
bun add jsx-email
npm add jsx-email
yarn add jsx-email
Our Tailwind component is lightning quick and extensible. No other email template system is as flexible or renders smaller with Tailwind styles. That’s because we leverage the insanely fast and flexible UnoCSS project for Atomic CSS - including Tailwind andWindi CSS support. Not only do you get Tailwind support, but also the vast ecosystem of UnoCSS possibilities.
Tips
These are docs for the unified jsx-email package, and the Tailwind component contained within.
Note: Most email clients are style-limited and some styles may not work. It’s always recommended
to use email check to check your CSS for client compatibility.
This option allows customizing the theme for your template, using UnoCSS Configuration as well as UnoCSS layers, presets, rules, separators, shortcuts, and variants. See: Configuration for type and further information. For more information on theming and any of the other customization options, please see https://unocss.dev/config/.
production?: boolean;
If true, any Tailwind class names will be converted to hashed names. e.g. The class bg-purple-400 is transformed into #ae387, with an accompanying class in the associated <style> tag. This is adventageous as it reduces the overall size of the rendered email. In email, every byte counts towards your user’s experience.
Tips
Gmail is one of the more restrictive email clients when it comes to CSS classes. When using the <Tailwind /> component, set the production: true prop for Gmail compatibility. The Tailwind
component will hash and combine class names for compatibility with Gmail’s rules.
Tailwind Plugins
The Tailwind component isn’t compatible with Tailwind Plugins out of the box. This is a side-effect of using UnoCSS for our Tailwind processor. However, UnoCSS does have a set of commonly-used equivalent core UnoCSS presets, Community Presets, and Transformers. While not entirely ideal for 1:1 Tailwind plugin support, complex rulesets and plugins are an unlikely need for formatting emails. If you’d like to port a Tailwind plugin to an UnoCSS present, there is documentation for that as well.
Should you find yourself in need of a Tailwind Plugin for an email template, please stop by our Discord Channel and we’ll be happy to help you.