Skip to content

Conversation

@gabrielmfern
Copy link
Member

@gabrielmfern gabrielmfern commented Nov 4, 2025

I was improving a few things on our copy-paste components, and I noticed that the margin defined in

<Body style={{ margin: 0, marginLeft: 12, marginRight: 12 }}>

was being applied to the inner td tag as per #2325, but, since the body by default in the browser has some margin, it was simply ignored, causing the body to actually have extra margins. Some email clients also apply this extra margin and resetting it here would be the expected behavior imo.


Summary by cubic

Reset Body component margins to prevent double spacing when users set margin styles. This zeros the body’s margin while keeping user-defined margins on the content for consistent rendering across browsers and email clients.

  • Bug Fixes
    • If a margin-related style is passed to Body, set the same margin on the body to 0 to avoid stacking with default client margins.
    • Added tests and snapshots covering all margin properties (margin, top/bottom/left/right, inline/block variants).

Written for commit 2a23b6f. Summary will update automatically on new commits.

@gabrielmfern gabrielmfern self-assigned this Nov 4, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: 2a23b6f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@react-email/body Minor
@react-email/components Minor
@react-email/tailwind Major
@react-email/preview-server Patch
react-email Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
react-email Ready Ready Preview Comment Nov 4, 2025 2:07pm
react-email-demo Ready Ready Preview Comment Nov 4, 2025 2:07pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 4, 2025

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email/@react-email/body@2637
npm i https://pkg.pr.new/resend/react-email/@react-email/preview-server@2637
npm i https://pkg.pr.new/resend/react-email@2637

commit: 2a23b6f

@gabrielmfern gabrielmfern merged commit aa2bc86 into canary Nov 4, 2025
16 checks passed
@gabrielmfern gabrielmfern deleted the fix/body-margin-resetting branch November 4, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants