wix-incubator / mjml-react

React component library to generate the HTML emails on the fly
MIT License
993 stars 50 forks source link

Custom Components #18

Closed PurpleNecho closed 5 years ago

PurpleNecho commented 5 years ago

Is there a way to add custom MJML components or are you planning on adding this feature?

mastertheblaster commented 5 years ago

Hi @PurpleNecho,

Currently we don't see a reason to add support for this. IMHO it can be achieved by composing existing react components.

class MyFancyButton {
  render() {
     return [
       <MjmlRaw>
         <p>Some raw component</p>
       </MjmlRaw>
       <MjmlSection>
         <MjmlColumn>...</MjmlColumn>
         <MjmlColumn>...</MjmlColumn>
       </MjmlSection>
     ];
  }
}

Can you share your usecase? And maybe we would change our mind :) And on the other hand - we do accept PRs :)

PurpleNecho commented 5 years ago

Thanks for the quick answer. A usecase would be a button component with conditional comments and VML for older Outlook versions in which case it would be quite tedious to repeat the component for every instance of that button. But on the other hand i can see that i would be possible to achieve this with just the MjmlRaw component.

mastertheblaster commented 5 years ago

Hi @PurpleNecho,

Could you share a code snippet of such button? Maybe there are other alternatives also, but you are right MjmlRaw can do anything.

Cheers

mastertheblaster commented 5 years ago

Closing for now, please feel free to reopen if needed.

Cheers