Back to Mjml

README

packages/mjml-button/README.md

5.1.06.9 KB
Original Source

mj-button

Displays a customizable button.

<figure> </figure> <div class="alert alert-important" role="alert"> <p>Important</p> <p>The <code>mj-button</code> won't be fully clickable because of client support. See discussion at <a href="https://github.com/mjmlio/mjml/issues/359">Issue #359</a>.</p> </div>
xml
<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-button font-family="Helvetica" background-color="#f45e43" color="white">
          Don't click me!
         </mj-button>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>
<div class="alert alert-note" role="alert"> <p>Note</p> <p><code>mj-button</code> is an "ending tag", which means that it can contain HTML code but it cannot contain other MJML components.</p> <p>More information about ending tags <a href="#ending-tags">in this section</a>.</p> </div>

Attributes

attributeacceptsdescriptiondefault value
alignleft center righthorizontal alignmentcenter
background-colorCSS color formatsbutton background-color#414141
borderstringCSS border formatnone
border-bottomstringCSS border format
border-leftstringCSS border format
border-radiusstringborder radius3px
border-rightstringCSS border format
border-topstringCSS border format
colorCSS color formatstext color#ffffff
container-background-colorCSS color formatsbutton container background color
css-classstringclass name, added to the root HTML element created
font-familystringfont nameUbuntu, Helvetica, Arial, sans-serif
font-sizepxtext size13px
font-stylestringCSS values, e.g. normal italic oblique
font-weightstringtext thicknessnormal
heightpx %button height
hrefstringURL format
inner-paddingpx %inner button padding,
supports up to 4 parameters10px 25px
letter-spacingpx emletter-spacing
line-heightpx %line-height on link120%
namestringspecify the name attribute for the button link
paddingpx %button container padding, supports up to 4 parameters10px 25px
padding-bottompx %button container bottom padding
padding-leftpx %button container left padding
padding-rightpx %button container right padding
padding-toppx %button container top padding
relstringspecify the rel attribute for the button link
targetstringspecify the target attribute for the button link_blank
text-alignleft center righttext-align button content
text-decorationstringunderline/overline/nonenone
text-transformstringcapitalize/uppercase/lowercasenone
titlestringtooltip & accessibility
vertical-aligntop bottom middle verticalvertical alignmentmiddle
widthpx %button width
<p class="cta-container"><a class="cta" href="https://mjml.io/try-it-live/components/button">Try it live</a></p>