Blocks
Button
A link drawn as a button. The Button component's props, styles and an example, in Hyper Elements.
import { Button } from "@hyper-elements/react";Example
Get started (https://example.com/start) Read the docs (https://example.com/docs)
- infoemail/outlook-degraded
borderRadius on this Button in classic Outlook: square corners
root.children[0].children[0].children[0].style.borderRadius - infoemail/outlook-degraded
borderRadius on this Button in classic Outlook: square corners
root.children[0].children[0].children[1].style.borderRadius
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="x-apple-disable-message-reformatting"><!--[if !mso]><!--><meta http-equiv="X-UA-Compatible" content="IE=edge"><!--<![endif]--><meta name="format-detection" content="telephone=no,address=no,email=no,date=no,url=no"><meta name="color-scheme" content="light"><meta name="supported-color-schemes" content="light"><!--[if mso]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--><style>table,td{mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse}img{-ms-interpolation-mode:bicubic}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}.eu8kvx:hover{background-color:#d93425!important}.emvznp:hover{background-color:#f1f5f9!important}@media (max-width: 540px){.eezu4q>div{width:100%!important;max-width:100%!important}.eqan3y{height:12px!important}}</style></head><body style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:#fff"><div role="article" aria-roledescription="email" style="background-color:#fff;overflow-wrap:break-word;word-break:break-word"><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#ffffff" style="background-color:#fff"><tr><td align="center"><!--[if mso]><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="520" align="center"><tr><td><![endif]--><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="max-width:520px"><tr><td><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td style="padding:24px"><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="eezu4q" align="center" style="font-size:0"><!--[if mso]><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td width="150" valign="top" style="width:150px"><![endif]--><div style="display:inline-block;vertical-align:top;width:100%;max-width:150px;font-size:16px"><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:separate"><tr><td align="center" bgcolor="#ef4638" class="eu8kvx" style="background-color:#ef4638;border-radius:8px;mso-padding-alt:12px 22px"><a href="https://example.com/start" style="display:block;padding:12px 22px;color:#fff;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;font-weight:600;line-height:16.8px;mso-line-height-rule:exactly;text-align:center;text-decoration:none;border-radius:8px">Get started</a></td></tr></table></div><!--[if mso]></td><td width="12" style="width:12px"></td><![endif]--><!--[if !mso]><!--><div class="eqan3y" style="display:inline-block;width:12px"></div><!--<![endif]--><!--[if mso]><td width="170" valign="top" style="width:170px"><![endif]--><div style="display:inline-block;vertical-align:top;width:100%;max-width:170px;font-size:16px"><table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:separate"><tr><td align="center" bgcolor="#ffffff" class="emvznp" style="background-color:#fff;border:1px solid #cbd5e1;border-radius:8px;mso-padding-alt:12px 22px"><a href="https://example.com/docs" style="display:block;padding:12px 22px;color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;line-height:16.8px;mso-line-height-rule:exactly;text-align:center;text-decoration:none;border-radius:8px">Read the docs</a></td></tr></table></div><!--[if mso]></td></tr></table><![endif]--></td></tr></table></td></tr></table></td></tr></table></td></tr></table><!--[if mso]></td></tr></table><![endif]--></td></tr></table></div></body></html>Show the code
import { Button, Column, Email, Row } from "@hyper-elements/react";
export default function Example() {
return (
<Email width={520} style={{ backgroundColor: "#ffffff", fontFamily: "Inter, Helvetica, Arial, sans-serif", color: "#0f172a", gap: 16 }}>
<Column style={{ padding: 24, gap: 16 }}>
<Row style={{ gap: 12, justifyContent: "center" }}>
<Button
href="https://example.com/start"
style={{ backgroundColor: "#ef4638", borderRadius: 8, padding: [12, 22], fontWeight: 600, width: 150 }}
hover={{ backgroundColor: "#d93425" }}
>
Get started
</Button>
<Button
href="https://example.com/docs"
style={{ backgroundColor: "#ffffff", color: "#0f172a", border: "1px solid #cbd5e1", borderRadius: 8, padding: [12, 22], width: 170 }}
hover={{ backgroundColor: "#f1f5f9" }}
>
Read the docs
</Button>
</Row>
</Column>
</Email>
);
}Reference
A link drawn as a button.
Holds: text; Span, MergeTag, LineBreak. Drawn in: email, page.
Props:
href: link (required)title: text. Shown as a tooltip by mail clients and browsers that show one.aria-label: text. What a screen reader says for it, where its text alone doesn’t say enough (“Read more about pricing”).attrs: attributes. More attributes for its link: a class, adata-attribute.
style:
color: color (default"#ffffff", inherited)fontFamily: fontFamily (inherited)fontSize: a length (a number of px) (default14, inherited)fontWeight: fontWeight (inherited)fontStyle: one of “normal”, “italic” (inherited)lineHeight: lineHeight (default1.2, inherited)letterSpacing: a length (a number of px) (inherited)textAlign: one of “left”, “center”, “right”, “justify” (default"center", inherited)textTransform: one of “none”, “uppercase”, “lowercase”, “capitalize” (inherited)textDecoration: one of “none”, “underline”, “line-through”width: a length (a number of px, %)maxWidth: a length (a number of px, %)padding: insets (default{"top":10,"right":20,"bottom":10,"left":20})backgroundColor: color (default"#0879a1")border: borderborderRadius: radius (default4)boxSizing: one of “border-box”, “content-box”. Whether its width holds its padding and border (border-box), or they go on top of it (content-box).alignSelf: one of “start”, “center”, “end”. Where it sits in its stack, whatever the stack’s alignItems: on phones too, another place than on desktop.flex: flex. In a Row: its share of the width left after children with a width (default 1); “none” takes its own size.
hover: color, backgroundColor.
mobile (on phones): fontSize, lineHeight, letterSpacing, textAlign, width, maxWidth, padding, border, alignSelf.