Mjml: MJ-Social custom Icon not working

Created on 31 Oct 2016  路  11Comments  路  Source: mjmlio/mjml

Hi

For some reason I can't get the custom social networks working at all.

<mj-social 
            display="custom-network" 
            custom-network-icon="https://vodacom-now-blog.s3.amazonaws.com/uploads/image/image/277/facebook.png"
            custom-network-href="http://www.google.com/"
          />

any help would be greatly appreciated.

Question

Most helpful comment

Hey @dawidvdh,

By default, text-mode is set to true, which means you need to define a content for your social icon.

Note that content is mandatory if text-mode is set to true

You can omit a content by setting text-mode to false.

Please also add an icon-color (you can set it to none if you don't want any.

This MJML code should work:

<mjml>
  <mj-body>
    <mj-container>
      <mj-section>
        <mj-column>
          <mj-social 
          display="custom-network" 
          text-mode="false"
          custom-network-icon-color="none"
          custom-network-icon="https://vodacom-now-blog.s3.amazonaws.com/uploads/image/image/277/facebook.png" 
          custom-network-href="http://www.google.com/" />
        </mj-column>
      </mj-section>
    </mj-container>
  </mj-body>
</mjml>

Let me know if it helps!

All 11 comments

Hey @dawidvdh,

By default, text-mode is set to true, which means you need to define a content for your social icon.

Note that content is mandatory if text-mode is set to true

You can omit a content by setting text-mode to false.

Please also add an icon-color (you can set it to none if you don't want any.

This MJML code should work:

<mjml>
  <mj-body>
    <mj-container>
      <mj-section>
        <mj-column>
          <mj-social 
          display="custom-network" 
          text-mode="false"
          custom-network-icon-color="none"
          custom-network-icon="https://vodacom-now-blog.s3.amazonaws.com/uploads/image/image/277/facebook.png" 
          custom-network-href="http://www.google.com/" />
        </mj-column>
      </mj-section>
    </mj-container>
  </mj-body>
</mjml>

Let me know if it helps!

Awesome that works thanks!

It works with one icon (one social). How can be work with 4 socials? (for example: facebook, youtube, vimeo and linkedin?

If I paste the code twice the icones align vertically and not horizontally

hey @kaiusvreo, put the different social networks in the same mj-social tag and use mode="horizontal" to display the icons side by side: https://mjml.io/documentation/#mjml-social

ngarnier, thanks so much for your reply,
I understand how it works, and it works.
I have only one thing to fix, how is possible to change the size of the icon?
My icon is 30x30px but it has the same size of the original icon

https://mjml.io/try-it-live/HkmM46r5x

You can use icon-size: https://mjml.io/try-it-live/SyjNBaH5l (I cleaned a bit your code as you were using invalid attributes such as margin, height and width.

ngarnier you rock!
thanks so so so so so much!
it's perfect!

These examples do not work anymore. What's changed?

The syntax changed in MJML v4 @Premitium https://mjml.io/try-it-live/components/social

These are the regular icons, what about having custom ones?

Was this page helpful?
0 / 5 - 0 ratings