Conditional

Use HTML conditional comments effortlessly

pnpm
aube
bun
npm
yarn
pnpm add jsx-email

Usage

Add the component to your email template. Include styles where needed.

import { Conditional, Head } from 'jsx-email';

const Email = () => {
  return (
    <Head>
      <Conditional mso={true}>
        <meta content="batman" />
      </Conditional>
    </Head>
  );
};

Component Props

interface ConditionalProps {
  children?: React.ReactNode;
  expression?: string;
  mso?: boolean;
}
Info

The expression prop or the mso prop must be defined, but not both.

Props

expression?: string;

If provided, the string will be used as the conditional expression within the HTML comment. e.g. a value of lt ie 10 would result in a conditional comment block starting with ....