4.9.3 • Published 3 years ago

mjml-social-node6 v4.9.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

mj-social

Displays calls-to-action for various social networks with their associated logo. You can add social networks with the mj-social-element tag.

<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-social font-size="15px" icon-size="30px" mode="horizontal">
          <mj-social-element name="facebook" href="https://mjml.io/">
            Facebook
          </mj-social-element>
          <mj-social-element name="google" href="https://mjml.io/">
            Google
          </mj-social-element>
          <mj-social-element  name="twitter" href="https://mjml.io/">
            Twitter
          </mj-social-element>
        </mj-social>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>
attributeunitdescriptiondefault value
alignstringleft/right/centercenter
border-radiuspxborder radius3px
colorcolortext color#333333
css-classstringclass name, added to the root HTML element createdn/a
container-background-colorcolorinner element background colorn/a
font-familystringfont nameUbuntu, Helvetica, Arial, sans-serif
font-sizepx/emfont size13px
font-stylestringfont stylenormal
font-weightstringfont weightnormal
icon-heightpercent/pxicon height, overrides icon-sizeicon-size
icon-sizepercent/pxicon size (width and height)20px
inner-paddingpxsocial network surrounding padding4px
line-heightpercent/pxspace between lines22px
modestringvertical/horizontalhorizontal
paddingpxsupports up to 4 parameters10px 25px
padding-bottompxbottom offsetn/a
padding-leftpxleft offsetn/a
padding-rightpxright offsetn/a
padding-toppxtop offsetn/a
icon-paddingpxpadding around the icons0px
text-paddingpxpadding around the texts4px 4px 4px 0
text-decorationstringunderline/overline/nonenone

mj-social-element

This component enables you to display a given social network inside mj-social.
Note that default icons are transparent, which allows background-color to actually be the icon color.

attributeunitdescriptiondefault value
alignstringleft/right/centercenter
altstringimage alt attributenone
background-colorcoloricon colorEach social name has its own default
border-radiuspxborder radius3px
colorcolortext color#333333
css-classstringclass name, added to the root HTML element createdn/a
font-familystringfont nameUbuntu, Helvetica, Arial, sans-serif
font-sizepx/emfont size13px
font-stylestringfont stylenormal
font-weightstringfont weightnormal
hrefurlbutton redirection urlnone
icon-heightpercent/pxicon height, overrides icon-sizeicon-size
icon-sizepercent/pxicon size (width and height)20px
line-heightpercent/pxspace between lines22px
namestringsocial network name, see supported list belowN/A
paddingpxsupports up to 4 parameters4px
padding-bottompxbottom offsetn/a
padding-leftpxleft offsetn/a
padding-rightpxright offsetn/a
padding-toppxtop offsetn/a
icon-paddingpxpadding around the icon0px
text-paddingpxpadding around the text4px 4px 4px 0
sizesmedia query & widthset icon width based on queryn/a
srcurlimage sourceEach social name has its own default
srcseturl & widthset a different image source based on the viewportn/a
relstringspecify the rel attribute for the linkn/a
targetstringlink target_blank
titlestringimg title attributenone
text-decorationstringunderline/overline/nonenone
vertical-alignstringtop/middle/bottommiddle

Supported networks with a share url:

  • facebook
  • twitter
  • google
  • pinterest
  • linkedin
  • tumblr
  • xing

Without a share url:

  • github
  • instagram
  • web
  • snapchat
  • youtube
  • vimeo
  • medium
  • soundcloud
  • dribbble

When using a network with share url, the href attribute will be inserted in the share url (i.e. https://www.facebook.com/sharer/sharer.php?u=[[URL]]). To keep your href unchanged, add -noshare to the network name. Example :

<mj-social-element name="twitter-noshare" href="my-unchanged-url">Twitter</mj-social-element>

Custom Social Element

You can add any unsupported network like this:

<mj-social-element href="url" background-color="#FF00FF" src="path-to-your-icon">
  Optional label
</mj-social-element>

You can also use mj-social this way with no href attribute to make a simple list of inlined images-texts.