Container
Horizontally center child components and content
Install
Install the component from your command line
console
pnpm add jsx-emailpnpm add jsx-emailconsole
bun add jsx-emailbun add jsx-emailconsole
npm add jsx-emailnpm add jsx-emailconsole
yarn add jsx-emailyarn add jsx-emailUsage
Add the component to your email template. Include styles where needed.
jsx
import { Button, Container } from 'jsx-email';
const Email = () => {
return (
<Container>
<Button href="https://example.com" style={{ color: '#61dafb' }}>
Click me
</Button>
</Container>
);
};import { Button, Container } from 'jsx-email';
const Email = () => {
return (
<Container>
<Button href="https://example.com" style={{ color: '#61dafb' }}>
Click me
</Button>
</Container>
);
};INFO
Though the Container component wraps a <table> element, it has a specific use-case and does not support setting cellPadding or cellSpacing. If attempting to use Container as a table, please consider using a Section component or a combination of Row and Column.
Component Props
ts
disableDefaultStyle?: boolean;disableDefaultStyle?: boolean;If true, instructs the component not to add default style properties to the component. This can be useful when attempting to override default styles with Tailwind or class names.
TIP
This component also expresses all of the Common Component Props for ComponentProps<'table'> except for cellPadding and cellSpacing.