react-email icon indicating copy to clipboard operation
react-email copied to clipboard

Container does not center content in some clients

Open ganondev opened this issue 1 year ago • 2 comments

Describe the Bug

Mostly just raising this issue to bring visibility to #1035 as it's quite small and has been open for a bit.

According to Container:

Container

A layout component that centers all the email content.

However a quick demo of this using the preview app in chrome proves this isn't the case, at least not always. Content will align to the left by default. I was able to fix this using the adjustments in the above PR.

Which package is affected (leave empty if unsure)

@react-email/container

To Reproduce

Put any content in a <Container/> and preview it in the dev server.

Expected Behavior

Content should be centered.

What's your node version? (if relevant)

18.17.1

ganondev avatar Nov 20 '23 15:11 ganondev

Container does what it is supposed to do, it is basically like what Tailwind's container class does.

This should bring a documentation fix not a change to the component as this could even be a breaking change for those who are using the component.

gabrielmfern avatar Jan 22 '24 17:01 gabrielmfern

<Container>
  <div className="text-center">
    <Button
      href="https://hello.com"
      style={{ background: '#000', color: '#fff', padding: '12px 20px' }}
    >
      Hello
    </Button>
  </div>
</Container>

this centers it with tailwind

zirho avatar Feb 23 '24 19:02 zirho