Blocks

Text

A paragraph of text. The Text component's props, styles and an example, in Hyper Elements.

import { Text } from "@hyper-elements/react";

Example

Show the code
text.tsx
import { Column, Email, LineBreak, Link, MergeTag, Text, Span } 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 }}>
        <Text style={{ fontSize: 16, lineHeight: 1.6 }}>
          Hi <MergeTag name="first_name" />, your build <Span style={{ fontFamily: "Menlo, monospace", backgroundColor: "#f1f5f9" }}>#2705</Span> passed.
          <LineBreak />
          <Span style={{ fontWeight: 700 }}>3 templates</Span> changed. <Link href="https://example.com/diff">See the diff</Link>.
        </Text>
      </Column>
    </Email>
  );
}

Reference

A paragraph of text.

Holds: text; PageNumber, Span, Link, LineBreak, MergeTag, Image. Drawn in: email, page.

Props:

  • dir: one of “ltr”, “rtl”, “auto”. Its text’s direction, where it differs from the template’s; it starts on that side unless aligned otherwise.

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)
  • textDecoration: one of “none”, “underline”, “line-through”
  • width: a length (a number of px, %)
  • maxWidth: a length (a number of px, %)
  • padding: insets
  • backgroundColor: color
  • border: border
  • borderRadius: radius
  • 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, padding, border.