Background
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 `Background` component when it fits the email's content and layout. Use inside body layout for image-backed sections. Use hosted images, a fallback `bgColor`, explicit width/height where possible, and simple nested `Row`/`Column` content. Reference the component docs at https://jsx.email/docs/components/background.
A JSX email component for background images in your Email template
pnpm
aube
bun
npm
yarn
pnpm add jsx-emailUsage
Add the background component to your email template.
import { Body, Column, Html, Section } from 'jsx-email';
const Email = () => {
return (
<Html lang="en">
<Body>
<Background src="link-to-image" bgColor="#FFFFFF" width={600}>
<Row>
<Column>Content goes here</Column>
</Row>
</Background>
</Body>
</Html>
);
};Component Props
interface BackgroundProps extends Omit<
React.ComponentPropsWithoutRef<'td'>,
'height' | 'width' | 'bgcolor'
> {
src: string;
bgColor?: string;
bgRepeat?: 'repeat' | 'no-repeat';
height?: number;
width?: number;
}src: string;The path to the image
bgColor?: string;The hex code that represents the fallback background-color incase the image doesn’t load
bgRepeat?: 'repeat' | 'no-repeat';A string that represents the value of background-repeat.
Default value is no-repeat
height?: number;The height of the container in pixels
width?: number;The width of the container in pixels