Skip to content

fix(heading): keep units and auto in margin shortcut props - #3932

Open
NickFasulo wants to merge 1 commit into
resend:canaryfrom
NickFasulo:fix/heading-margin-units
Open

NickFasulo wants to merge 1 commit into
resend:canaryfrom
NickFasulo:fix/heading-margin-units

Conversation

@NickFasulo

@NickFasulo NickFasulo commented Nov 23, 2026 •

Copy link
Copy Markdown

Fixes #3924

What

<Heading> margin shortcut props always got px appended, so mt="1.5rem" rendered margin-top:1.5rempx and values like auto or m="0 auto" were dropped entirely.

Fix

withSpace now resolves each prop per token:

  • bare numbers and numeric strings (10, "10", -5) still get px appended
  • values already carrying a unit ("1.5rem", "10px", "10%"), auto, and multi-value shorthands of those ("0 auto", "10px 20px") are emitted unchanged
  • anything that isn't a CSS length or auto ("invalid", "10 px", "") is still dropped, preserving the existing invalid-value behavior

Testing

New cases in utils.spec.ts for both withMargin and withSpace covering unit passthrough, auto, shorthands, numeric px suffixing, and invalid-value dropping. pnpm vitest run src/components/heading — 18/18 pass. Typecheck clean, biome lint clean.


Summary by cubic

Fixes #3924 by making <Heading> margin shortcut props preserve units and auto values instead of always appending px. Previously mt="1.5rem" rendered margin-top:1.5rempx and values like auto or m="0 auto" were dropped entirely. Numeric values still get px appended, values with units, auto, and multi-value shorthands pass through unchanged, and invalid values like "10 px" are still dropped.

Written for commit ab9e85e. Summary will update on new commits.

View guided diff

@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ab9e85e

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

This PR includes changesets to release 3 packages
Name Type
react-email Patch
@react-email/editor Patch
@react-email/ui 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

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@NickFasulo is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Nov 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heading: margin shortcut props (m, mt, mx, ...) produce invalid CSS for values with units such as "1.5rem" or "10px"

1 participant