Socket
Socket
Sign inDemoInstall

mjml-social

Package Overview
Dependencies
3
Maintainers
6
Versions
126
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mjml-social

mjml-social


Version published
Weekly downloads
466K
decreased by-16.48%
Maintainers
6
Install size
13.5 MB
Created
Weekly downloads
 

Readme

Source

mj-social

desktop

`mj-social-element`'s `name` attribute is a shortcut for some common social elements.
You should avoid rely too much on this as those icons are hosted by Mailjet for their Email Builder.
Use custom element syntax instead.

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-element name="x" href="https://mjml.io/">
            X
          </mj-social-element>
        </mj-social>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

try it live

`mj-social-element` is an "ending tag", which means it can contain HTML code which will be left as it is, so it can contain HTML tags with attributes, but it cannot contain other MJML components. More information about ending tags in this section.
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 attribute''
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
  • x
  • 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.

FAQs

Last updated on 05 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc