Blocks
Table
A table of data: TableRows of TableCells. Columns take their cells' widths; the rest share what's left.
import { Table } from "@hyper-elements/react";Example
Output | Root | Browser needed Email HTML | Email | No PDF | Document | No
- No diagnostics. Nothing to fix, nothing degraded.
<!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}</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 cellpadding="0" cellspacing="0" border="0" width="100%" style="table-layout:fixed;border-collapse:separate"><colgroup><col width="158" style="width:33.47%"><col width="157" style="width:33.26%"><col width="157" style="width:33.26%"></colgroup><thead><tr bgcolor="#f8fafc" style="background-color:#f8fafc"><th scope="col" width="158" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;font-weight:700;line-height:21px;mso-line-height-rule:exactly;text-align:left;width:33.47%;box-sizing:border-box;padding:10px 12px;border-bottom:1px solid #e2e8f0">Output</th><th scope="col" width="157" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;font-weight:700;line-height:21px;mso-line-height-rule:exactly;text-align:left;width:33.26%;box-sizing:border-box;padding:10px 12px;border-bottom:1px solid #e2e8f0">Root</th><th scope="col" width="157" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;font-weight:700;line-height:21px;mso-line-height-rule:exactly;text-align:right;width:33.26%;box-sizing:border-box;padding:10px 12px;border-bottom:1px solid #e2e8f0">Browser needed</th></tr></thead><tbody><tr><td width="158" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;line-height:21px;mso-line-height-rule:exactly;text-align:left;width:33.47%;box-sizing:border-box;padding:10px 12px;border-bottom:1px solid #e2e8f0">Email HTML</td><td width="157" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;line-height:21px;mso-line-height-rule:exactly;text-align:left;width:33.26%;box-sizing:border-box;padding:10px 12px;border-bottom:1px solid #e2e8f0">Email</td><td width="157" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;line-height:21px;mso-line-height-rule:exactly;text-align:right;width:33.26%;box-sizing:border-box;padding:10px 12px;border-bottom:1px solid #e2e8f0">No</td></tr><tr><td width="158" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;line-height:21px;mso-line-height-rule:exactly;text-align:left;width:33.47%;box-sizing:border-box;padding:10px 12px">PDF</td><td width="157" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;line-height:21px;mso-line-height-rule:exactly;text-align:left;width:33.26%;box-sizing:border-box;padding:10px 12px">Document</td><td width="157" valign="top" style="color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:14px;line-height:21px;mso-line-height-rule:exactly;text-align:right;width:33.26%;box-sizing:border-box;padding:10px 12px">No</td></tr></tbody></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 { Column, Email, Table, TableCell, TableRow } 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 }}>
<Table style={{ cellPadding: [10, 12], rowBorder: "1px solid #e2e8f0", fontSize: 14 }}>
<TableRow header style={{ backgroundColor: "#f8fafc" }}>
<TableCell>Output</TableCell>
<TableCell>Root</TableCell>
<TableCell style={{ textAlign: "right" }}>Browser needed</TableCell>
</TableRow>
<TableRow>
<TableCell>Email HTML</TableCell>
<TableCell>Email</TableCell>
<TableCell style={{ textAlign: "right" }}>No</TableCell>
</TableRow>
<TableRow>
<TableCell>PDF</TableCell>
<TableCell>Document</TableCell>
<TableCell style={{ textAlign: "right" }}>No</TableCell>
</TableRow>
</Table>
</Column>
</Email>
);
}Reference
A table of data: TableRows of TableCells. Columns take their cells’ widths; the rest share what’s left.
Holds: TableRow. Drawn in: email, page.
style:
color: color (inherited)fontFamily: fontFamily (inherited)fontSize: a length (a number of px) (inherited)fontWeight: fontWeight (inherited)fontStyle: one of “normal”, “italic” (inherited)lineHeight: lineHeight (inherited)letterSpacing: a length (a number of px) (inherited)textAlign: one of “left”, “center”, “right”, “justify” (inherited)textTransform: one of “none”, “uppercase”, “lowercase”, “capitalize” (inherited)width: a length (a number of px, %)maxWidth: a length (a number of px, %)backgroundColor: colorborder: bordercellPadding: insets. Every cell’s padding, where the cell doesn’t set its own.rowBorder: lineborderCollapse: one of “separate”, “collapse”. Whether cells side by side draw a border each (separate) or share one (collapse).flex: flex. In a Row: its share of the width left after children with a width (default 1); “none” takes its own size.
mobile (on phones): fontSize, lineHeight, letterSpacing, textAlign, width, maxWidth, border.